Commit graph

767 commits

Author SHA1 Message Date
photonstorm
1da95994a5 First pass of the newly re-structured Canvas Renderer (still using old texture system though). 2016-10-03 12:44:54 +01:00
photonstorm
f993769336 Lots of work on the new Texture classes. 2016-09-29 16:10:22 +01:00
Richard Davey
2590e67e2b First pass at the new consolidated Texture classes. Ultimately these will replace PIXI.BaseTexture, PIXI.Texture and Phaser.Frame. Objects will grab frame references, rather than creating their own Texture objects all the time. 2016-09-29 04:21:12 +01:00
Richard Davey
e47a7741c3 Modified showDebugHeader so it works on Chrome, FF and Safari. Updated colors and text. Removed the easter egg. 2016-09-29 02:48:48 +01:00
Richard Davey
5cb7cc8e92 Start of the new Children component. 2016-09-29 02:29:56 +01:00
photonstorm
c836d4bfbd PIXI.PI_2, PIXI.RAD_TO_DEG and PIXI.DEG_TO_RAD have all been removed, as they are no longer used internally, and are all available under Phaser.Math.
PIXI.VERSION has been removed, as it's no longer relevant and misleading.
2016-09-28 16:57:08 +01:00
photonstorm
a8d1bbcfdc PIXI.AbstractFilter has been merged into the Phaser.Filter class.All references to PIXI.AbstractFilter have been updated to use Phaser.Filter instead. 2016-09-28 14:30:15 +01:00
Richard Davey
811c347cc3 Camera.fade has a new argument alpha to control the alpha level of the effect (thanks @rgk #2493)
Camera.flash has a new argument `alpha` to control the alpha level of the effect (thanks @rgk #2493)
2016-09-27 01:07:40 +01:00
Kevin Albertson
a512763508 Fixed fixedToCamera update for Group. 2016-09-25 22:39:59 -04:00
Richard Davey
b0ce81bec0 Multiple Batched Texture support is now available. This is a WebGL feature that can seriously decrease the volume of draw calls made in complex, or asset heavy, games. To enable it you can either use the new renderer type Phaser.WEBGL_MULTI, or you can pass the property multiTexture: true in a Phaser.Game configuration object. Once enabled, it cannot be disabled.
`game.renderer.setTexturePriority` is the method that goes with the Multiple Texture support. It takes an array as its single argument. The array consists of Phaser.Cache image key strings. Phaser will then try to batch as many of the textures as it can, depending on the hardware limits. If for example the GPU can only batch 8 textures, and you provide an array of 16, then only the first 8 in the array will be batched.
2016-09-19 23:31:32 +01:00
Richard Davey
f990e632f1 Tidying-up code style. 2016-09-07 23:23:47 +01:00
samme
b67073c62d Test for camera.fx before resetting 2016-09-04 11:18:08 -07:00
photonstorm
ad0e4aca2e Large batch of jshint fixes. 2016-08-25 13:03:41 +01:00
Filip Nedyalkov
64a02ddef4 fixed top, bottom, left, right, centerX and centerY to use the updated getBounds and compute their values depending on the parent local coordinate space. I think this is better than using the global getBounds and a lot more convenient because it makes total sense x and centerX for example to be from the same coordinate space and also with this change now these values would be working when the group is a top level display object and also when it is parented by something else. So this loosens the global only getBounds restriction. Also it doesn't really makes sense to align objects with totally different parents but if that is the case separate calculations could be made. 2016-08-02 17:47:35 +03:00
Richard Davey
02d078500c Merge pull request #2656 from leopoldobrines7/documentHidden-compatibility
Check if hidden is available first
2016-07-23 12:09:00 +01:00
Richard Davey
79e135087f ScaleManager.hasPhaserSetFullScreen is a new boolean that identifies if the browser is in full screen mode or not, and if Phaser was the one that requested it. As it's possible to enter full screen mode outside of Phaser, and it then gets confused about what bounding parent to use. 2016-07-21 02:11:16 +01:00
Leopoldo Brines
1e7cd986ee Check if hidden is available first 2016-07-20 20:04:25 -04:00
Richard Davey
60b8d78ab8 Group.align updates. 2016-07-20 12:29:30 +01:00
Dave Eargle
209b588f8b fix documentation for group.align -- row and column were swapped 2016-07-18 20:39:32 -04:00
Richard Davey
4548d70369 Experimenting with new MainLoop + position interpolation. (reverted from commit e49d45e278) 2016-07-13 02:44:35 +01:00
Richard Davey
e49d45e278 Experimenting with new MainLoop + position interpolation. 2016-07-12 03:05:29 +01:00
photonstorm
9b4bb1bdd8 Group.getRandomExists will return a random child from the Group that has exists set to true.
Group.getAll will return all children in the Group, or a section of the Group, with the optional ability to test if the child has a property matching the given value or not.

Group.iterate has a new `returnType`: `RETURN_ALL`. This allows you to return all children that pass the iteration test in an array.
2016-07-11 17:05:42 +01:00
photonstorm
1467eb48cf A Group with inputEnableChildren set would re-start the Input Handler on a Sprite, even if that handler had been disabled previously. 2016-07-11 14:17:51 +01:00
Richard Davey
0014201917 Groups now have the following properties, which are getters and setters: centerX, centerY, left, right, top and bottom. These calculate the bounds of the Group, based on all visible children, and then allow you to apply positioning based on that. This means you can, for example, now get the horizontal center of a Group by called Group.centerX. These properties are also setters, so you can position the Groups, and it will take scale and rotation into consideration.
Groups have a new method `alignIn`. It allows you to align the Group within another Game Object, or a Rectangle. You can specify one of 9 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.CENTER` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily place Groups into the corners of the screen, or game world, or align them within other Sprites, using this method.

Groups have a new method `alignTo`. It allows you to align a Group to the side of another Game Object, or a Rectangle. You can specify one of 11 positions which are the new position constants such as: `Phaser.TOP_LEFT` or `Phaser.LEFT_BOTTOM` (see docs for the complete list). The Groups are positioned based on their child bounds, which takes rotation and scaling into consideration. You can easily align Groups next to other Sprites using this method.
2016-07-08 01:33:42 +01:00
Mike Headley
fca0a625b0 Distance comparison opposite of intended. Fixing so it will save the smaller distance instead of the greater. 2016-06-21 22:20:27 -07:00
Richard Davey
2bd4f68ea0 Small tweaks to #2577 and TS defs. 2016-06-21 22:18:09 +01:00
Mike Headley
48616c8854 Replacing lost Group.getClosestTo documentation lines. 2016-06-20 14:26:30 -07:00
Mike Headley
2e91588f87 Refactored original getClosestTo and getFurthestFrom functions to include optional filter callback. Removed the getClosestToFilter and getFurthestFromFilter. 2016-06-20 14:07:12 -07:00
Mike Headley
ad0f31be8d Added Group.getClosestToFilter() and Group.getFurthestFromFilter() 2016-06-19 10:45:35 -07:00
photonstorm
697a2ae94e Fixed issue in Group.align where the cell wouldn't increase if rows was great than -1 2016-06-17 15:28:39 +01:00
Richard Davey
a9976d2703 Phaser 2.5.0 Release. 2016-06-17 12:46:56 +01:00
photonstorm
4da3b15ae2 Renamed alignTo to alignIn, and added the new method alignTo, to allow for Sprite to Sprite alignment. Updated all of the Bounds and TS defs. 2016-06-16 17:01:51 +01:00
Richard Davey
853d770764 Group.align is a new method that allows you to layout all the children of the Group in a grid formation. You can specify the dimensions of the grid, including the width, height and cell size. You can also control where children are positioned within each grid cell. The grid width and height values can also be set to -1, making them fluid, so the grid expands until all children are aligned. Finally an optional child index argument can be set. This is a great way to quickly and comprehensively align Group children, and has lots of use cases. 2016-06-16 02:50:24 +01:00
Richard Davey
fc7a3934d2 Group.align working. 2016-06-16 02:28:49 +01:00
Richard Davey
32cf1f1a9c Group.createMultiple can now accept Arrays for both the key and frame arguments. This allows you to create multiple sprites using each key and/or frame in the arrays, which is a great and quick way to build diverse Groups. See the JSDocs for complete details and code examples. 2016-06-15 22:36:23 +01:00
Richard Davey
5415d9b603 Stage and Group postUpdate methods iterate the same way now. 2016-06-09 23:14:24 +01:00
photonstorm
a65f9c7e4b Group.onChildInputDown is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an onInputDown signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
Group.onChildInputUp is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputUp` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.

Group.onChildInputOver is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputOver` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.

Group.onChildInputOut is a new Signal that you can listen to. It will be dispatched whenever any immediate child of the Group emits an `onInputOut` signal itself. This allows you to listen for a Signal from the Group, rather than every Sprite within it.
2016-06-09 16:19:11 +01:00
photonstorm
458a67251d Fixed input property check. 2016-06-09 15:09:20 +01:00
photonstorm
24f4abe760 Group.add has a new optional argument index which controls the index within the group to insert the child to. Where 0 is the bottom of the Group.
Group.addAt has been refactored to be a simple call to `Group.add`, removing lots of duplicate code in the process.

Group.create has a new optional argument `index` which controls the index within the group to insert the child to. Where 0 is the bottom of the Group. It also now makes proper use of `Group.add`, cutting down on more duplicate code.

Group.createMultiple now returns an Array containing references to all of the children that the method created.
2016-06-09 14:58:35 +01:00
photonstorm
e8e7e27184 The DisplayObject.renderOrderID used to run in reverse. I.e. in a display list with 10 sprites on it, the first sprite (at the bottom of the list, rendering behind all the others) would have a renderOrderID of 9, where-as the top-most sprite, rendering above all others, would have a renderOrderID of 0. While this didn't cause any side-effects internally, it's arguably illogical. So the process has been reversed, and renderOrderIDs are now accumulative, starting at zero each frame, and increasing as it iterates down the display list. So the higher the ID, the more "on-top" of the output the object is.
`InputHandler.validForInput` and `Pointer.processInteractiveObjects` have been updated to reflect the new `renderOrderID` sequence (see above).
2016-06-09 12:32:37 +01:00
Richard Davey
de3d749385 Farthest swapped for the more common Furthest. 2016-06-05 23:01:00 +01:00
photonstorm
ee6f277b31 PluginManager.remove has a new argument destroy (defaults to true) which will let you optionally called the destroy method of the Plugin being removed. 2016-06-03 15:52:17 +01:00
photonstorm
9ae43757b9 Group.removeAll has a new argument destroyTexture which allows you to optionally destroy the BaseTexture of each child, as it is removed from the Group (thanks @stoneman1 #2487) 2016-06-03 13:11:03 +01:00
Richard Davey
45bd98ee18 Fixed issue with camera target sync. 2016-06-02 23:20:46 +01:00
Richard Davey
645a614326 Stage has had all of its core update loops modified, so they now iterate through the display list forwards, instead of in reverse. Stage.postUpdate is now also a lot smaller, with no conditional branching if there is a Camera Target or not. 2016-06-02 22:45:31 +01:00
Richard Davey
09d09aaf84 Removed the updateTransform calls from the frame loop, because it happens automatically as part of Game.updateLogic anyway, so was duplicating the workload for no reason. 2016-06-02 22:41:03 +01:00
Richard Davey
eb1c61826c The camera now divides its effects (like shake and fade) updates, and the updateTarget into two separate functions. 2016-06-02 22:40:30 +01:00
photonstorm
68c29470cf The way the display list updates and Camera movements are handled has been completely revamped, which should result is significantly smoother motion when the Camera is following tweened or physics controlled sprites. The Stage.postUpdate function is now vastly reduced in complexity. It takes control over updating the display list (calling updateTransform on itself), rather than letting the Canvas or WebGL renderers do this. Because of this change, the Camera.updateTarget function uses the Sprites worldPosition property instead, which is now frame accurate (thanks @whig @Upperfoot @Whoisnt @hexus #2482) 2016-06-02 16:38:21 +01:00
photonstorm
dfa8b9dedc Refactored Group.getClosestTo and Group.getFurthestFrom. 2016-06-02 15:11:23 +01:00
photonstorm
a52bbf621b Added missing property. 2016-06-02 15:02:44 +01:00