This PR depends on [#1150] (https://github.com/photonstorm/phaser/pull/1150)!
(I apologize for all the different pull requests in a short time period. I finally got some time to do some development tonight and have been making my way through many of my TODO items.)
This adds support for CocoonJS.App's 'onSuspended' and 'onActivated' events, making it so that the timers and sounds are stopped/started and muted/unmuted when the user swaps an app from the background to the fore or the reverse.
Because neither ['onActivated'] (http://doc.ludei.com/2.0.2/CocoonJS_App/symbols/CocoonJS.App.html#.event:onActivated) nor ['onSuspended'] (http://doc.ludei.com/2.0.2/CocoonJS_App/symbols/CocoonJS.App.html#.event:onSuspended) send an Event object themselves, this patch fakes sending an object by creating one during the function call and giving it a 'type' property for visibilityChange() to check against.
StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
P2.InversePointProxy.mx and my values are get and set in meters with no pixel conversion taking place.
P2.PointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
P2.InversePointProxy.x and y values are now returned in pixels (previously they were returned in meters). See PointProxy.mx/my for meter values.
Ninja Physics is no longer included in the build files by default. Not enough people were using it, and not enough contributions were coming in to help polish it up, so we've saved the space and removed it. It's still available in the grunt build files if you require it, but we're deprecating it from the core library at this time. It will make a return in Phaser3 when we move to a modular class system.
BitmapData.refreshBuffer has been removed and replaced with BitmapData.update.
BitmapData.drawSprite has been removed due to deprecation. Use BitmapData.draw instead.
Pointer.moveCallback has been removed due to deprecation.
SinglePad.addButton has been removed due to deprecation.
P2.Body.loadData has been removed due to deprecation.
P2.World.defaultFriction and defaultRestitution have been removed due to deprecation.
Canvas.create noCocoon parameter has been removed due to deprecation.
Color.getColorInfo, RGBtoHexstring, RGBtoWebstring and colorToHexstring has been removed due to deprecation.
Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
SinglePad.destroy now clears all associated GamepadButton objects and signals.
Group.onDestroy is a new signal that is dispatched whenever the Group is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)