Commit graph

3646 commits

Author SHA1 Message Date
Richard Davey
a532f7b2c4 Optimised Math.getShortestAngle. 2016-07-29 03:58:25 +01:00
Richard Davey
688752c5de Math.getShortestAngle will return the shortest angle between the two given angles. Angles are in the range -180 to 180, which is what Sprite.angle uses. So you can happily feed this method two sprite angles, and get the shortest angle back between them (#2494) 2016-07-29 03:39:51 +01:00
Richard Davey
3c3d09e46a Docs update. 2016-07-29 03:39:51 +01:00
Richard Davey
fb5ba0aa62 Bail out if no parent. 2016-07-29 03:39:51 +01:00
Richard Davey
24368ef8d7 Docs update. 2016-07-29 03:39:51 +01:00
Felipe Alfonso
8960cf26d7 texture meta data parsed and saved in cache 2016-07-28 21:33:31 -04:00
Felipe Alfonso
1b9f25b820 texture binary loading. 2016-07-28 18:42:46 -04:00
Filip Nedyalkov
7b4d6a65ca fixed getLocalBounds() to return the bounds of the DisplayObject without transformations and adjusted width and height to work the way they did before to be compatible with how PIXI used to work. 2016-07-28 21:41:34 +03:00
Felipe Alfonso
08ec080f67 PVR, DDS, KTX and PKM parsing implemented on LoaderParser.js 2016-07-27 19:47:05 -04:00
Felipe Alfonso
f68f454620 Fix Tiling Sprite mask and filter 2016-07-27 12:49:42 -04:00
Felipe Alfonso
1711266ff8 Fixed multi texture support on tiling sprite. 2016-07-27 00:36:20 -04:00
Felipe Alfonso
6e35817675 Fixed issue with multiple "texture not bound to unit X" webgl warning 2016-07-26 11:49:21 -04:00
photonstorm
3e1595ffaf Removed debugger calls. 2016-07-26 14:57:48 +01:00
photonstorm
f246c276cb Multi-Texture support has now been built into our version of Pixi. This can offer dramatic performance increases in WebGL games on GPUs that support multiple texture bindings (which is most of them these days).
WebGLRenderer.setTexturePriority is the method used to set the priority of textures when the GPU supports multi-texture batching.

Rope has two new properties `textureIndices` and `textureIndex` to handle multi-texture support.

Strip has two new properties `textureIndices` and `textureIndex` to handle multi-texture support.

The following shaders have all been updated to support multi-textures: `ComplexPrimitiveShader`, `PixiFastShader`, `PixiShader`, `PrimitiveShader`, `StripShader`.

WebGLFastSpriteBatch.vertSize was increased from 10 to 11.

BaseTexture.textureIndex is a new property that controls the index of the texture within the GPU texture cache. Usually you don't change this yourself, and use `renderer.setTexturePriority` instead, but the property is public and available for more advanced use-cases.

CanvasRenderer.setTexturePriority is an empty function, but included to allow you to simply call `game.renderer.setTexturePriority` without first having to wrap that in a WebGL check.
2016-07-26 14:56:12 +01:00
photonstorm
dfaf0b99dd Merge branch 'multitexture-gl' into dev 2016-07-26 14:47:26 +01:00
photonstorm
2318fec65c Start of a Particle base class. 2016-07-26 14:31:36 +01:00
photonstorm
86affde81b The file pixi/utils/Polyk.js has been removed, as it was no longer used with Pixi or Phaser (we replaced it with EarCut a while ago) 2016-07-26 14:30:06 +01:00
Filip Nedyalkov
566c781f26 Merge remote-tracking branch 'refs/remotes/photonstorm/dev' into display-object-container-dimensions-fix 2016-07-26 14:10:15 +03:00
Filip Nedyalkov
c56bc766cc Overrided getLocalBounds() for PIXI Sprite, Strip and Graphics
Since they override the getBounds of the DisplayObjectContainer, the
getLocalBounds should also be overriden for them to properly work.
2016-07-26 14:01:35 +03:00
James Robinson
118d2057c0 Allow animation speed greater than 0 2016-07-25 19:43:19 -07:00
Felipe Alfonso
4d09b31560 Merge branch 'dev' into multitexture-gl 2016-07-25 15:50:57 -04:00
Richard Davey
9654a4b3c5 Consolidating Layers into View class. 2016-07-25 01:39:46 +01:00
Richard Davey
19e609185a Math.rotateToAngle takes two angles (in radians), and an interpolation value, and returns a new angle, based on the shortest rotational distance between the two. 2016-07-25 00:39:38 +01:00
Richard Davey
8d4a72c9d7 Phaser 2.7.0 Beta 3 2016-07-23 15:05:52 +01:00
Richard Davey
b69cae4206 The methods setStageReference and removeStageReference have been removed from all Pixi classes. Objects no longer have stage properties, or references to the Stage object. This is because no reference to the Stage is required for any calculations, and Phaser can only have 1 Stage, so adding and removing references to it were superfluous actions. 2016-07-23 14:31:17 +01:00
Richard Davey
ce764e098d As a result of changes in #2573 Graphics objects were calling updateLocalBounds on any shape change, which could cause dramatic performances drops in Graphics heavy situations (#2618). Graphics objects now have a new flag _boundsDirty which is used to detect if the bounds have been invalidated, i.e. by a Graphics being cleared or drawn to. If this is set to true then updateLocalBounds is called once in the postUpdate method (thanks @pengchuan #2618) 2016-07-23 12:52:35 +01:00
Richard Davey
fb1a7f13cb Merge pull request #2639 from fmflame/display-object-container-dimensions-fix
Fix for DisplayObject/DisplayObjectContainer - getting dimensions or bounds do NOT retrieve proper values
2016-07-23 12:18:06 +01: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
6947057427 The property checkCollision.none in the ArcadePhysics.Body class was available, but never used internally. It is now used and checked by the separate method. By setting checkCollision.none = true you can disable all collision and overlap checks on a Body, but still retain its motion updates (thanks @samme #2661) 2016-07-23 10:01:38 +01:00
Richard Davey
ab739bdce0 Added back in undefined Tileset check. 2016-07-23 09:43:20 +01:00
Richard Davey
46c20ab00a The property checkCollision.none has been removed from the ArcadePhysics.Body class. It was never used internally, so lead to confusion about its use. To disable a body, use body.enable = false (thanks @samme #2661) 2016-07-23 09:43:01 +01:00
photonstorm
30e9273eb8 Removed console.log. 2016-07-22 17:38:46 +01:00
photonstorm
3ba00bbf2d Loads of work on tilemap collision, and offset support. You can now collide with a tilemap no matter where it is on the screen, or which layer it's from. 2016-07-22 17:02:10 +01:00
photonstorm
0e25c5acac Revert getTiles call. 2016-07-22 14:08:54 +01:00
photonstorm
9fb27b6fe2 Moving all the getTiles calls back again, as it's just a bit TOO API breaking to move them, for the sake of a few KB. 2016-07-22 14:05:35 +01:00
Richard Davey
d8560eb3bc Fixed Tilemap collision. 2016-07-22 04:32:56 +01:00
Richard Davey
d14250304c Defs update. 2016-07-22 04:19:17 +01:00
Richard Davey
91b9513e7e TilemapLayer.getTileX, getTileY and getTileXY all now required a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.
Tilemap.getRayCastTiles now requires a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.

Tilemap.getTiles now requires a Phaser.TilemapLayer (or Phaser.TilemapLayerGL) as the first argument.
2016-07-22 04:10:55 +01:00
Richard Davey
0301330c2d jshint fixes. 2016-07-22 03:59:10 +01:00
Richard Davey
020cb01056 Canvas tilemap renderer fixes. 2016-07-22 03:55:21 +01:00
Felipe Alfonso
062c7cd95a Added setTexturePriority function to WebGLRenderer 2016-07-21 22:34:27 -04:00
Richard Davey
be92e41366 The private methods TilemapLayer._fixX, _unfixX, _fixY and _unfixY have been moved to `Tilemap. 2016-07-22 03:20:56 +01:00
Richard Davey
ef9f53e350 TilemapLayer.getRayCastTiles has been moved to Tilemap.getRayCastTiles.
TilemapLayer.rayStepRate has been moved to Tilemap.rayStepRate.
TilemapLayer.getTiles has been moved to Tilemap.getTiles.
2016-07-22 03:03:50 +01:00
Felipe Alfonso
1755bfd779 Merge branch 'dev' into multitexture-gl 2016-07-21 21:51:14 -04:00
Felipe Alfonso
44774d648e Final implementation related to multi texture batching 2016-07-21 21:49:29 -04:00
Richard Davey
f669202fb4 Loads of refactoring. Removed the internal layer creation, added in first/last gid detection, sorted out multiple identical layer creation. 2016-07-22 02:39:35 +01:00
Richard Davey
9eff79f2c2 Phaser.Tileset has a new property lastgid which is populated automatically by the TilemapParser when importing Tiled map data, or can be set manually if building your own tileset. 2016-07-22 02:35:33 +01:00
Richard Davey
91e7b2ca9c Updated properties. 2016-07-22 00:30:55 +01:00
Pete Baron
8c6fec0e97 Apply "half pixel correction" to the source coordinates for tiles when drawing with WebGL. 2016-07-22 11:30:06 +12:00
Richard Davey
8832680aa0 Exposed 'width' and 'height' properties on TilemapLayer, so it can be resized and update all children. 2016-07-22 00:09:31 +01:00
Richard Davey
ed9793e06b Removed un-needed baseTexture dirty call. 2016-07-21 22:55:10 +01:00
Richard Davey
e384724b28 Doesn't need to extend DoC, can extend DO instead. 2016-07-21 22:54:39 +01:00
photonstorm
6661952d50 Masses of changes to get tilemap layer display dimensions filtering down to linked child layers. Also allowed offset to work correctly, and fixed the display sizes with offset bounds. Exposed offset as layer.x/y. Need to duplicate in canvas variation. 2016-07-21 16:56:17 +01:00
Pete Baron
d994641d52 Don't scale the clip offset value when the layer is scaled. 2016-07-22 00:23:05 +12:00
Pete Baron
3faca89831 oops my bad: rename 2016-07-22 00:12:56 +12:00
Pete Baron
7c2dae0773 Add offset parameter to TilemapLayerGL and use it with clipping to draw a view into a map at a specified location and size in the game window. 2016-07-22 00:02:05 +12:00
Richard Davey
c36babcc1c Code formatting and docs updates. 2016-07-21 10:45:23 +01:00
Felipe Alfonso
40b4b2dbd0 added multi texture to WebGLFastSpritebatch and Strip (wip) 2016-07-21 01:57:39 -04:00
Pete Baron
aecbd7c267 Add width/height to debug log for new layers. 2016-07-21 17:13:12 +12:00
Pete Baron
29c77e10d7 Send layer width/height to PIXI.Tilemap (previously these were ignored and forgotten after the c'tor).
Modify resize to set displayWidth/displayHeight only.
2016-07-21 17:12:46 +12:00
Pete Baron
008de253ce Add displaywidth/height parameters to PIXI.Tilemap c'tor and save them.
Clean up _initWebGL to remove unused GL buffers.
Clean up _renderBatch to remove unused srcWide/srcHigh variables.
Set new Tile Shader's clipping uniform using displayWidth/Height.
2016-07-21 17:10:51 +12:00
Pete Baron
5f55fb095e Tile shader uses clipping dimensions when drawing. 2016-07-21 17:07:50 +12:00
Pete Baron
42a2608036 Fix createInternalLayer to use the 'base layer' rather than assume this.layers[0] was the base layer for each new one. This makes the multi-tileset, multi-layer demos work correctly. 2016-07-21 16:27:35 +12:00
Pete Baron
37a9f4fa01 Remove console warn for invalid tile index as it was firing incorrectly (when processing a base layer which only uses tiles from another tileset). 2016-07-21 16:26:32 +12:00
Pete Baron
f958567a48 Remove more dead code. 2016-07-21 15:24:05 +12:00
Pete Baron
7454eb0aa0 Add console warning when invalid tile index is used. 2016-07-21 15:23:37 +12:00
Pete Baron
70f95d2558 Remove dead code (commented out).
Add flag to detect when an 'internal layer' is not needed (none of the specified tileset is used in the parent layer) and skip creating one.
2016-07-21 14:58:25 +12:00
Pete Baron
f9ff1d10c5 Apply rendersession.offset to the TilemapShader (fixes screen shake). 2016-07-21 14:16:17 +12:00
Richard Davey
5ecdee86c2 Merging in flipped tile support. 2016-07-21 02:32:08 +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
Filip Nedyalkov
d18f303d28 Fixed formatting to match the general formatting of the code 2016-07-21 03:38:41 +03:00
Filip Nedyalkov
7206453126 Just removed some whitespace I don't remember adding it... 2016-07-21 03:32:41 +03:00
Leopoldo Brines
1e7cd986ee Check if hidden is available first 2016-07-20 20:04:25 -04:00
Richard Davey
b90d7b28f8 Merge pull request #2654 from leopoldobrines7/fix-function
Fix 'TypeError: target.center is undefined'
2016-07-21 00:26:16 +01:00
Filip Nedyalkov
4f21e70852 Fix for PIXI's DisplayObject/DisplayObjectContainer - getting correct dimensions and bounds
With the previous fix what the getBounds did was:
1) if targetCoordinateSpace is the same instance as the caller of
getBounds(), then it will return the bounds of the caller without any
transformations;
2) if targetCoordinateSpace is null/undefined it will return the global
bounds of the caller.
3) if targetCoordinateSpace is any valid DisplayObject it will return
the local bounds of the caller.

What this fix does is fixing 3) along with other obsolete code that
wasn't necessary so I reverted it.
So now if the targetCoordinateSpace is a valid DisplayObject:
- if it's a parent of the caller at some level it will return the bounds
relative to it
- if it's not parenting the caller at all it will get global bounds of
it and the caller and will calculate the x and y bounds of the caller
relative to the targetCoordinateSpace  DisplayObject

Also I have fixed how empty groups are treated when they have no other
children except groups, so now calculations are correct. They obviously
have 0 width and height but are still being positioned and other things
could possibly relate to that bounds and it didn't make sense to me to
ignore them.

Also added a DisplayObjectContainer.contains(child) method which
determines whether the specified display object is a child of the
DisplayObjectContainer instance or the instance itself. This method is
used in the new getBounds function.

Corrected DisplayObject's default _bounds rect from (0, 0, 1, 1), to (0,
0, 0, 0) - it doesn't seem to break anything and also in the getBounds
before the fix, when there were no children it assigned a (0, 0, 0, 0)
rectangle to it so I am pretty sure it's safe to correct it.
2016-07-21 02:14:10 +03:00
Richard Davey
b9d34ca843 Added debug object back in. 2016-07-20 23:44:41 +01:00
Leopoldo Brines
18472f5998 Fix 'TypeError: target.center is undefined' 2016-07-20 18:34:02 -04:00
Richard Davey
d982003760 Lots more tidying up and adding jsdocs. 2016-07-20 20:06:59 +01:00
Richard Davey
ca6985e2f2 Removed lots of redundant code and tidied up bad formatting. 2016-07-20 19:27:32 +01:00
Richard Davey
7645e773dc More tidying and jshint fixing. 2016-07-20 17:28:19 +01:00
Richard Davey
82fb296b2a Code formatting issues. 2016-07-20 17:00:00 +01:00
Richard Davey
49fb798f60 Fixed createInternalLayer loop. 2016-07-20 16:24:06 +01:00
Richard Davey
cff28860fa The Loader.headers object has a new property requestedWith. By default this is set to false, but it can be used to set the X-Requested-With header to XMLHttpRequest (or any other value you need). To enable this do this.load.headers.requestedWith = 'XMLHttpRequest' before adding anything to the Loader #2398 2016-07-20 12:45:11 +01:00
Richard Davey
60b8d78ab8 Group.align updates. 2016-07-20 12:29:30 +01:00
Richard Davey
8139d484a3 Merge pull request #2649 from boniatillo-com/boniatillo-com-patch-jsdoc-intersectsRectangle
jsdoc fix: complete the Phaser.Line.intersectsRectangle @method tag
2016-07-20 12:10:47 +01:00
Richard Davey
29a2f65922 Merge pull request #2648 from boniatillo-com/jsdoc-fixes
jsdoc fix: replace #onTop for #onCeiling
2016-07-20 12:10:20 +01:00
Richard Davey
dc6d3e2680 Merge pull request #2643 from deargle/group-align-documentation-fix
fix documentation for group.align -- row and column were swapped
2016-07-20 12:08:22 +01:00
Richard Davey
418c87ea1a Weapon.autofire wouldn't fire after the first bullet, or until fire was called, neither of which are requirements. If you now set this boolean the Weapon will fire continuously until you toggle it back to false (thanks @alverLopez #2647) 2016-07-20 11:52:48 +01:00
Richard Davey
1105e4821d Added more info to console.warn. 2016-07-20 04:53:21 +01:00
Felipe Alfonso
6d21a4ca18 First working example of multi texture support 2016-07-19 23:17:13 -04:00
Felipe Alfonso
1f72355e8a Fixed issue with disabled vertex attribute 2016-07-19 22:06:37 -04:00
Felipe Alfonso
601573b62c working on setting up texture index on vertex buffer object. 2016-07-19 21:32:38 -04:00
Boniatillo.com
a465a0e8c7 jsdoc fix: complete the Phaser.Line.intersectsRectangle @method tag
complete the @method tag of Phaser.Line.intersectsRectangle with the class prefix.
2016-07-19 08:51:51 -04:00
Boniatillo.com
881dca3cc5 Fix jsdoc: change to #audioSprite
The Phaser.Loader.audioSprite method is using #audiosprite in its jsdoc. Here it is changed to #audioSprite.
2016-07-19 08:41:39 -04:00
Boniatillo.com
3d1b10c310 jsdoc fix: replace #onTop for #onCeiling
Modified the jsdoc of Phaser.Arcade.Body.onCeiling, by replacing the #onTop reference for #onCeiling.
2016-07-19 08:32:34 -04:00
Felipe Alfonso
bb53624418 Merge branch 'dev' into multitexture-gl 2016-07-18 22:54:34 -04:00
Felipe Alfonso
f97b0c4016 Moved texture index to vertex buffer to avoid memory overhead 2016-07-18 22:50:44 -04:00
Dave Eargle
209b588f8b fix documentation for group.align -- row and column were swapped 2016-07-18 20:39:32 -04:00
Richard Davey
3574d86bba Code formatting and copyright text. 2016-07-18 23:39:09 +01:00
Richard Davey
1e181fa30d Tidying up new Tilemap classes. 2016-07-18 23:24:49 +01:00
Richard Davey
d3e460567b Updated config to handle WebGL Tilemap renderer for testing. 2016-07-18 23:05:03 +01:00
Richard Davey
8d1b670df1 Merge remote-tracking branch 'origin/webgl-tilemap' into dev 2016-07-18 23:00:35 +01:00
Pete Baron
e3f402ec06 Clean-up and comments. 2016-07-18 13:28:20 +12:00
Pete Baron
550954210e Clean-up and comments. 2016-07-18 13:24:29 +12:00
Pete Baron
9daf6d0525 Clean-up and comments. 2016-07-18 13:19:15 +12:00
Pete Baron
5f6ea15c58 Clean-up and comments. 2016-07-18 13:09:43 +12:00
Pete Baron
263238ba42 Comments and clean-up. 2016-07-18 12:56:34 +12:00
Pete Baron
fdb80f1a55 Modify Tile Shader to produce scaled layers that look identical to the Canvas renderer scaling (add uCentreOffset, scale the drawing coordinates, subtract uCentreOffset). 2016-07-18 12:43:59 +12:00
Pete Baron
0b392e19a2 Remove unused precalculated u/v scale factor. 2016-07-18 12:41:32 +12:00
Pete Baron
e87fc84527 comment - Tile.scale is currently unused 2016-07-18 12:40:08 +12:00
Filip Nedyalkov
483a3b6836 Fix for DisplayObject/DisplayObjectContainer - getting dimensions or bounds do NOT retrieve proper values
* Documentation
* TypeScript Defs
* Nothing, it's a bug fix

Describe the changes below:
I noticed that getting dimensions or bounds changed in Phaser 2.6.1 and
it was bugged - returned dimensions were doubled in the direction of the
scaling for example, but the nice thing was that this time the
dimensions included the rotation of the object - which I think should be
the default behavior. It also bugged getLocalBounds which started
returning global getBounds();
When I checked the previous version of phaser 2.5.0 - total different
story. getLocalBounds returns the object without any transformations to
it. Getting width and height works ok, but rotation wasn't calculated to
the dimensions at all.
In all cases only getBounds returned proper dimensions, which is
obviously not enough and this is also a very important issue to be
resolved as soon as possible since it's a major core component feature
used all the time.
That's why I decided to spare the time and hopefully find a good fix for
all of this mess and I think I finally got there and tried to make the
changes as much as possible with your Code of Conduct. This is actually
the first time I am requesting a pull so I hope it will do some good. I
did compare my results with how Flash handles dimensions - they match,
so I do hope I didn't miss something and believe you guys would make
sure everything works ok.
To help you with reviewing and possibly (and hopefully) accepting this
pull request I've made available online 3 demos of the issues and with
demo of the fix of course:
1.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemo_v2.5.0/
2.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemo_v2.6.1/
3.
http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemoFixed_v2.6.1/

Here is a zip file of the demo projects (build with VS2015):

http://www.nedyalkov.net/filip/demos/phaser/IncorrectDisplayObjectDimensionsDemos.zip

I really hope to see this FIX in the next version - would help me and a
lot of people I guess to get the job done properly!

Thank you!
2016-07-18 02:32:29 +03:00
Richard Davey
b405570833 Docs fix #2624 2016-07-17 11:26:09 +01:00
Richard Davey
6f9bcae23e Docs fixes #2629 2016-07-17 11:23:41 +01:00
Richard Davey
0765e9eaa6 Merge pull request #2634 from greeny/hotfix-bitmapdata-fluent
BitmapData.js: fixed fluent interface
2016-07-17 11:20:40 +01:00
Richard Davey
776c148a93 Fixed jshint errors. 2016-07-16 08:04:56 +01:00
Tomáš Blatný
2b90f2cb3b BitmapData.js: fixed fluent interface 2016-07-15 20:16:35 +02:00
Felipe Alfonso
44d9f08c06 Merge branch 'dev' into multitexture-gl 2016-07-14 19:45:28 -04:00
Felipe Alfonso
e73837aa77 Texture Index working on common shaders. Still need to disable draw call for texture changing 2016-07-14 19:44:10 -04:00
Felipe Alfonso
2f41d9cf57 Sampler Array working correctly for WebGLSpriteBatch + PixiShader 2016-07-13 00:40:32 -04:00
Felipe Alfonso
9aa71e5e90 Added comments to shaders to help with debugging with WebGL Inspector. 2016-07-12 23:30:30 -04:00
Richard Davey
a01f59d82d Added Path Manager Plugin. 2016-07-13 03:08:03 +01: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
Richard Davey
265501b4af The src/system folder has been removed and all files relocated to the src/utils folder. This doesn't change anything from an API point of view, but did change the grunt build scripts slightly. 2016-07-11 22:38:09 +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
photonstorm
94498fcd32 The InputHandler.flagged property has been removed. It was never used internally, or exposed via the API, so was just overhead. 2016-07-11 14:17:41 +01:00
photonstorm
9aef9b741c Preparing for 2.6.2 dev. 2016-07-11 10:30:09 +01:00
photonstorm
ac2516f5aa 2.6.1 Release. 2016-07-11 10:07:56 +01:00
Richard Davey
cfb2b813ef Fixed Uncaught TypeError: Cannot set property 'x' of undefined in Body.js (thanks @ErwanErwan #2607) 2016-07-08 18:54:00 +01:00
photonstorm
aaa9f0d61a Preparing for 2.6.1 dev. 2016-07-08 16:18:59 +01:00
photonstorm
fced3f86ec Phaser 2.6.0 Release. 2016-07-08 15:46:26 +01:00
photonstorm
8a8fa0297d Preparing for release. 2016-07-08 14:26:31 +01:00
photonstorm
61ce14f332 P2.World.clear will now clear out the World.walls property, resetting all of the wall bounds to null. This allows the walls to be re-created accurately when the P2 World is reset, which happens on a State change or restart (thanks @ewpolly1 @codermua #2574) 2016-07-08 13:02:58 +01:00
photonstorm
521a6c9dbb Sound.stop will check to see if gainNode exists before trying to disconnect from it. 2016-07-08 12:27:12 +01:00
photonstorm
c34c7bae4e Docs updates. 2016-07-08 12:04:28 +01:00
photonstorm
dfd9203e0a onWorldBounds now sends the bounds it collided with. 2016-07-08 11:28:45 +01:00
photonstorm
ee202667ed Huge docs update for all of the Game Object events. 2016-07-08 11:28:30 +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
Richard Davey
410237881e PIXI.DisplayObjectContainer calls updateTransform at the start of getBounds to help avoid the bounds being out of date. 2016-07-08 01:06:25 +01:00
Richard Davey
c0ba439e82 ArcadePhysics.Body.onCollide is a new Signal that is dispatched whenever the Body collides with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: sprite.body.onCollide = new Phaser.Signal() and it will be called when a collision happens, passing two arguments: the sprites which collided.
ArcadePhysics.Body.onOverlap is a new Signal that is dispatched whenever the Body overlaps with another Body. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onOverlap = new Phaser.Signal()` and it will be called when an overlap happens, passing two arguments: the sprites which collided.
2016-07-07 23:16:18 +01:00
Richard Davey
6ba3c9401f ArcadePhysics.Body.setCircle is a new method that allows you to define an Arcade Physics Body as being a circle instead of a rectangle. You can control the radius of the body and the offset from the parent sprite.
ArcadePhysics.World.separateCircle is a new method that handles all circular body collisions internally within Arcade Physics (thanks @VitaZheltyakov)

All of the Arcade Physics internal methods, such as `collideGroupVsSelf`, `collideSpriteVsSprite` and so on, have been updated to work with circular body shapes (thanks @VitaZheltyakov)

ArcadePhysics.Body.onWorldBounds is a new Signal that is dispatched whenever the Body collides with the world bounds, something that was previously difficult to detect. Due to the potentially high volume of signals this could create it is disabled by default. To use this feature set this property to a Phaser.Signal: `sprite.body.onWorldBounds = new Phaser.Signal()` and it will be called when a collision happens, passing one argument: the sprite on which it occurred.
2016-07-07 21:58:39 +01:00
photonstorm
261155a683 Merged the arcade-circles branch back into 2.6 and tidied up lots of the source code. Needs checking as not working properly with rect vs. circle, but fine with circle vs. circle. 2016-07-07 16:45:10 +01:00
Richard Davey
97bba5f3c7 toABGR updated. 2016-07-06 22:40:05 +01:00
Richard Davey
d93019e86b Moved to 2.6.0 2016-07-06 22:40:00 +01:00
Richard Davey
63158a1dbf Argument swapped for destroyBaseTexture. 2016-07-06 22:31:26 +01:00
Richard Davey
c4d7870a31 * PIXI.Texture.fromImage, PIXI.BaseTexture.fromImage and PIXI.Sprite.fromImage have all been removed. They should never have actually been used, as they bypass the Phaser Loader, and don't factor in CORs or any other advanced loader settings.
* The PIXI.BaseTexture.imageUrl property has been removed, as it was never actually populated.
* The PIXI.BaseTexture._UID property has been removed, as it was never actually used internally.
* All references to PIXI.BaseTextureCache have been removed (primarily from BaseTexture.destroy and Texture.destroy), as the BaseTextureCache was never used internally by Phaser, or by our custom version of Pixi.
* PIXI.TextureCache has been removed. It was only ever used by the __default and __missing images that Phaser generates on start-up. It wasn't used internally by Phaser anywhere else, and the only references Pixi has to it have all been removed. If you need it in your own game, please refactor it to avoid it, or re-create the object on the PIXI global object.
* Canvases created by `BaseTexture.fromCanvas` no longer have the `_pixiId` property attached to them, as this was never used internally by Phaser or Pixi.
* PIXI.BaseTexture.updateSourceImage is now deprecated. Please use `Sprite.loadTexture` instead.
* The property PIXI.BaseTextureCacheIdGenerator has been removed, as it is no longer used internally by Phaser or Pixi.
* PIXI.Texture.addTextureToCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.removeTextureFromCache has been removed. The PIXI Texture Cache was never actually used by Phaser, and was leading to complications internally.
* PIXI.Texture.fromFrame and PIXI.Sprite.fromFrame have been removed. They relied on the PIXI Texture Cache, which was never actually used by Phaser, and was never used internally by Pixi either.
* The property PIXI.TextureCacheIdGenerator has been removed, as it was not used internally.
* The property PIXI.FrameCache has been removed, as it was not used internally.
2016-07-06 21:47:27 +01:00
Richard Davey
440e2afe7c * PIXI.CanvasPool no longer _just_ checks for null parent comparisons. It will check for all falsey parents, helping free-up canvases when the parent objects have been removed elsewhere.
* PIXI.CanvasPool.remove and `removeByCanvas` both now set the removed canvas width and height to 1.
2016-07-06 21:47:05 +01:00
Richard Davey
886c641ddc * The default image texture, for when none is supplied, is now available under Phaser.Cache.DEFAULT.
* The missing image texture, for when an image has failed to load, is now available under `Phaser.Cache.MISSING`.
* Phaser.Cache.addImage will now check the key given, and if `__default` or `__missing` it will update the new consts `Phaser.Cache.DEFAULT` and `Phaser.Cache.MISSING` accordingly, allowing you to replace the default or missing image textures used by Phaser.
* Phaser.Cache.getPixiTexture has now been removed, as the Pixi Cache isn't used internally anywhere any longer.
* Phaser.Cache.getPixiBaseTexture has now been removed, as the Pixi Cache isn't used internally anywhere any longer.
2016-07-06 21:46:40 +01:00
Richard Davey
8a3c71f050 CanvasPool parent checks are now falsey, not just !== null. 2016-07-06 20:59:42 +01:00
Richard Davey
33150018ad Text.fontPropertiesCanvas no longer uses a CanvasPool entry. 2016-07-06 20:59:28 +01:00
Richard Davey
3642ff0489 Phaser.Color.toABGR converts RGBA components to a 32 bit integer in AABBGGRR format. 2016-07-04 18:50:42 +01:00
photonstorm
e08e0861d0 Phaser.ArrayUtils.rotate is now deprecated. Please use Phaser.ArrayUtils.rotateLeft instead. 2016-07-04 13:09:36 +01:00
photonstorm
0036bf747f BitmapData has a new, optional, fifth argument: skipPool. By default BitmapData objects will ask for the first free canvas found in the CanvasPool, but this behavior can now be customized on a per object basis. 2016-07-04 12:57:08 +01:00
photonstorm
cb0861d881 The canvas created by Phaser.Debug for use when displaying debug data is no longer stored in the CanvasPool, and is instead a stand-alone canvas, free from ever being re-used by another game object. 2016-07-04 12:56:52 +01:00
photonstorm
7ebae00c8f Phaser 2.5.1 RC1 2016-07-01 16:57:36 +01:00
photonstorm
32bec66031 Docs update. 2016-06-29 16:18:54 +01:00
photonstorm
4066a8d8d8 All Pixi.Graphics methods that change the Graphics, i.e. drawShape, lineTo, arc, etc will now all automatically call Graphics.updateLocalBounds. This is so that the bounds of the Graphics object are kept updated, allowing you to scale and rotate the Graphics object and still obtain correct dimensions from it (thanks @kelu-smiley #2573) 2016-06-29 16:18:54 +01:00
Richard Davey
fdcbb9229b Phaser.ArrayUtils.shift is the opposite of ArrayUtils.rotate. It takes an array, removes the element from the end of the array, and inserts it at the start, shifting everything else 1 space in the process. 2016-06-29 02:08:42 +01:00
Richard Davey
1f570b49e8 Phaser.Utils.pad now calls toString on the input given, which means you can pass in common data typs such as numbers and have them padded and returned as strings. 2016-06-29 00:04:22 +01:00
Richard Davey
fbd1ba05f7 Phaser.Utils.reverseString will take the given string, reverse it, and then return it. 2016-06-27 22:43:53 +01:00
Richard Davey
a0c771d47e Text.setText has a new optional argument immediate which will re-create the texture immediately upon call, rather than wait for the next render pass to do so (thanks @Scraft #2594) 2016-06-27 22:42:01 +01:00
photonstorm
b24de1e561 Polygon.contains would only work with non-flattened Polygon objects. It now works with both flat and non-flat Polygons.
Graphics objects enabled for input would fail to do anything if a Phaser Polygon was given to the Graphics object (which it was in nearly all cases), as it wouldn't detect input correctly with flattened polygons (thanks @symbiane #2591)
2016-06-27 14:51:25 +01:00
Pete Baron
2a2c82ee3d Fixed the alpha blending (copied the approach from the TriangleStrip PIXI shader) for Tilemap layers. The "blank tilemap" example now works properly and blends the background layers when you use the number keys to switch primary layers. 2016-06-28 00:28:28 +12:00
Pete Baron
9e3a7ec537 Modified the batch creation code and the batch drawing code to only insert degenerate triangles at the end of rows or when a row is broken (e.g. by some empty tiles which we won't draw at all). This should speed things up by optimising the draw, and reducing the amount of data required to describe the batch.
PIXI.Tilemap - _renderBatch using a local 'degenerate' flag to signal to next iteration that one should be inserted before the next triangle.
Phaser.TilemapLayerGL - add degenerate markers at end of rows and whenever a row has a break in it (e.g. empty tiles)
Phaser.Tileset - new addDegenerate function which prevents double markers in a row
2016-06-27 18:24:56 +12:00
Pete Baron
2a4049d5ef Pass each Tile.alpha value and store it with the glBatch data.
NOTE: if implemented this will have to break the tile batch into separate batches based on the alpha values!  Need a chat with Rich...
2016-06-27 16:09:01 +12:00
Pete Baron
d43f29d839 Use the tilemap layer alpha value when batch rendering tiles. 2016-06-27 16:07:24 +12:00
Pete Baron
61635c930e Added offsets to render large tiles at the correct (according to Tiled editor) positions. 2016-06-27 15:21:55 +12:00
Pete Baron
b8c81c21c9 Removed resolveTileset from TilemapLayerGL, added new task to task list. 2016-06-27 15:14:08 +12:00
Pete Baron
20b3d92b9b Fixed large tiles vanishing at screen edges by making a clear distinction between the original tilemap tile width and height, and the collision width and height of tiles for each layer. The difference between these two is now applied when calculating the region to be drawn to fill the screen. 2016-06-27 15:02:20 +12:00
Pete Baron
4f1728c62d First working demo of multiple tileset sources specified in a single Tiled map layer being rendered as separate Batch drawing lists by the webgl renderer.
Phaser.Tilemap now creates internal map layers for each tileset except the first one (which will be handled by the createLayer call from the game).  It also stores a reference to each tileset where the new map layers can access it.
Phaser.TilemapLayerGL uses the new tileset reference to ensure the correct base image and tile sizes are used for each new layer.
PIXI.Tilemap: added initialisation of glBatch to null in c'tor.
Phaser.TilemapParser was cleaned up to remove the now unnecessary tilemap parameter and the attempt to create layers while parsing.
2016-06-27 14:41:46 +12:00
Pete Baron
8d4733c8a5 Commit current state of development before trying something different (see last note in the progress doc). Will revert to previous commits if this attempt fails. 2016-06-27 11:46:52 +12:00
Richard Davey
8c5cea066a Updated docs. 2016-06-23 00:45:24 +01:00
Richard Davey
e050c39357 Gamedevs do it in the render method. 2016-06-22 19:30:30 +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
80f12ec074 Merge pull request #2571 from uboot/dev
Fixed Animation.setFrame() for sprite index argument
2016-06-21 22:20:24 +01:00
Richard Davey
2bd4f68ea0 Small tweaks to #2577 and TS defs. 2016-06-21 22:18:09 +01:00
Richard Davey
8cde880d98 Merge pull request #2577 from LoneStranger/dev
Modifed Group.getClosestTo() and Group.getFurthestFrom() to add optional filter callback
2016-06-21 22:07:13 +01:00
Richard Davey
50434375a1 Tidy up formatting for #2585 2016-06-21 22:00:59 +01:00
Richard Davey
495cbb7c14 Merge pull request #2585 from stoneman1/dev
Added file type mappings to accept headers.
2016-06-21 21:56:36 +01:00
Stoneman1
4861df4b66 Added file type mappings to accept headers. 2016-06-21 18:05:56 +03:00
cryptographer
9fdbb2d25d Remove assignment to obsolete tileColor property 2016-06-20 22:29:05 -04: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
photonstorm
e39cd584bf The start of the PIXI re-documentation process. Time to remove the old YUIdoc syntax, and replace with JSDoc and more meaningful descriptions. 2016-06-20 15:50:51 +01:00
Mike Headley
3ef8e5011b Revert "Clarified health property in component Health documentation that 'kill' will be called if it goes below zero."
This reverts commit 18ae3b1ddb.
2016-06-20 07:38:01 -07:00
photonstorm
d119ffa539 Removed PIXI.DisplayObject.prototype._renderWebGL and PIXI.DisplayObject.prototype._renderCanvas as both were only there for ancient jshint tests. 2016-06-20 14:10:21 +01:00
photonstorm
bd30181a2a Docs update. 2016-06-20 12:18:39 +01:00
photonstorm
2310e5dc6f Sound.volume was accidentally repeated twice in the source (thanks @LoneStranger #2569) 2016-06-20 12:18:39 +01:00
Richard Davey
b0cb949b6c Merge pull request #2564 from gotenxds/dev
Added some data to image object types.
2016-06-20 11:55:01 +01:00
Mike Headley
18ae3b1ddb Clarified health property in component Health documentation that 'kill' will be called if it goes below zero. 2016-06-19 22:36:27 -07:00
David Hayes
8f36b96c8a Reorder Weapon.onFire argument order in documentation. 2016-06-19 20:39:51 -05:00
Mike Headley
ad0f31be8d Added Group.getClosestToFilter() and Group.getFurthestFromFilter() 2016-06-19 10:45:35 -07:00
Matthias Fuchs
0d45251e98 Fixed Animation.setFrame() for sprite index argument. 2016-06-17 22:34:11 +02: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
effb975a25 Preparing for 2.5.1 development. 2016-06-17 13:11:48 +01:00
Richard Davey
a9976d2703 Phaser 2.5.0 Release. 2016-06-17 12:46:56 +01:00
photonstorm
47f0224a40 Phaser 2.4.9 release. 2016-06-17 01:11:24 +01:00
photonstorm
9dd745167c Docs fix. 2016-06-16 17:18:49 +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
photonstorm
5bcf84f5a4 Added offsetX and offsetY arguments to Bounds.alignTo. 2016-06-16 15:51:12 +01:00
photonstorm
f64558c4ac Readme update. 2016-06-16 12:14:27 +01:00
Richard Davey
e659083818 Fixed jshint error. 2016-06-16 02:51:44 +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
ed8fbd9a6c All Game Objects with the Bounds component; which includes Sprites, Images, Text, BitmapText, TileSprites and anything that extend these, now have a new method alignTo. It allows you to align the Game Object to another Game Object, or a Rectangle. You can specify one of 9 positions which are the new constants: Phaser.TOP_LEFT, Phaser.TOP_CENTER and so on (see above for the complete list). The Game Objects are positioned based on their Bounds, which takes rotation, scaling and anchor into consideration. You can easily place Sprites into the corners or the screen or game world, or align them against other Sprites, using this method. 2016-06-16 02:00:46 +01:00
Richard Davey
0efcf68b21 The Game Object Bounds component has been updated to include two new properties: centerX and centerY. This means you can, for example, now get the horizontal center of a Sprite by called Sprite.centerX. These properties are also setters, so you can position the Game Objects, and it will take scale and anchor into consideration. 2016-06-16 01:00:11 +01:00
Richard Davey
123e61c018 The Game Object Bounds component has been updated so that it now provides setters for all of the properties, as well as getters. Previously Sprite.left, Sprite.right, Sprite.top and Sprite.bottom were read-only, but they are now available to be set as well, and take into consideration the anchor and scale of the Game Objects. 2016-06-16 00:33:48 +01:00
Richard Davey
d67e902760 Rectangle.getPoint is a new method that returns a point based on the given location constant, such as Phaser.BOTTOM_LEFT. It returns the same result as calling Rectangle.bottomLeft (etc) but unlike those getters you are able to provide your own Point object. 2016-06-15 23:39:15 +01:00
Richard Davey
64a44aab17 Added the following new constants: Phaser.TOP_LEFT, Phaser.TOP_CENTER, Phaser.TOP_RIGHT, Phaser.MIDDLE_LEFT, Phaser.MIDDLE_CENTER, Phaser.MIDDLE_RIGHT, Phaser.BOTTOM_LEFT, Phaser.BOTTOM_CENTER and Phaser.BOTTOM_RIGHT. 2016-06-15 23:37:48 +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
gotenxds
91987eff56 Added some data to image object types. 2016-06-15 13:09:47 +03:00
Richard Davey
70be74cb36 Lots of work on Body.moveTo and Body.moveFrom. Now working nicely. 2016-06-15 04:12:47 +01:00
Richard Davey
b5cc01132c Body.move tests. 2016-06-14 23:45:00 +01:00
photonstorm
bc00c900e9 BitmapData.smoothProperty is a new property that holds the string based prefix needed to set image scaling on the BitmapData context.
BitmapData.copyTransform allows you to draw a Game Object to the BitmapData, using its `worldTransform` property to control the location, scaling and rotation of the object. You can optionally provide

BitmapData.drawGroup now uses the new `copyTransform` method, to provide for far more accurate results. Previously nested Game Objects wouldn't render correctly, nor would Sprites added via `addChild` to another Sprite. BitmapText objects also rendered without rotation taken into account, and the Sprites smoothing property was ignored. All of these things are now covered by the new drawGroup method, which also handles full deep iteration down the display list.
2016-06-14 15:29:56 +01:00
photonstorm
189cbf4132 Added exists property. 2016-06-14 15:29:45 +01:00
photonstorm
6383f6b1fb Updated docs. 2016-06-14 15:29:38 +01:00
photonstorm
7817d47a25 Updated Cache docs. 2016-06-14 12:18:32 +01:00
photonstorm
ad3641830d Phaser.Matrix if passed a 0 value would consider it falsy, and replace it with the default by mistake. It now checks if the arguments are undefined or null and only then sets the defaults (thanks mmcs) 2016-06-14 12:18:23 +01:00
Richard Davey
7108bc3de3 Merge pull request #2552 from drhayes/dev
Distinguish between Arrays and Objects when cloning in Cache.getJSON.
2016-06-14 11:49:02 +01:00
photonstorm
fb3f7721cb Working through updating BitmapData.copy to use the source matrix instead, so it retains the correct draw sequence order. 2016-06-13 17:01:33 +01:00
photonstorm
1a3b06a9f4 The DisplayObject.worldRotation value didn't sign the wt.c value correctly, meaning the rotation would be wrong.
The `DisplayObject.worldScale` value didn't multiply the local objects scale into the calculation, meaning the value wasn't a true representation of the objects world scale.
2016-06-13 17:01:03 +01:00
Pete Baron
04980c8096 Remove hack to force WEBGL mode for testing. 2016-06-14 01:02:02 +12:00
Pete Baron
11c5300591 Remove dubious use of tile.index to reference the tilesets list (it seems unlikely that there would ever be a tilesets value for every tile, and a huge waste of memory if it was ever done that way).
TODO: look into putting the tileset index (or a tileset reference) into each Tile structure when building them to avoid resolveTilesets entirely too.
2016-06-14 00:43:46 +12:00
Pete Baron
7533005a62 Fix buffer size bug. 2016-06-14 00:00:18 +12:00
Pete Baron
b406d10d94 Comments, and removed reinitialisation of the glBatch list. 2016-06-13 18:40:51 +12:00
Pete Baron
310b151924 Removed pixiTest flag, using renderType instead. 2016-06-13 18:39:52 +12:00
Pete Baron
c7476a6583 Fixed bug where scroll was effectively applied twice. 2016-06-13 18:38:55 +12:00
Pete Baron
05efcfe36e Modified my PIXI.Tilemap class to accept the glBatch list of tile source and destination coordinates, convert them into a GL TRIANGLE_STRIP data buffer, then draw them as a single batch WebGL draw. 2016-06-13 17:28:35 +12:00
Pete Baron
a8405bd066 add comment 2016-06-13 17:26:33 +12:00
Pete Baron
57a6245f25 Made a copy of Phaser.TilemapLayer which instead extends PIXI.Tilemap, then added functions to build a batch list of tile source and destination coordinates (instead of drawing them directly onto a Canvas). This maintains all the existing Phaser functionality in regards to tile map decoding and interpretation, and also provides maximum performance from the PIXI component by using a TRIANGLE_STRIP to render everything as a single batch job. 2016-06-13 17:25:50 +12:00
Pete Baron
94d49f1196 Add GL variant of the Tileset.draw function for new approach to WebGL tile drawing (utilising most of the existing Phaser code unchanged) 2016-06-13 17:13:13 +12:00
David Hayes
346aed2866 Distinguish between Arrays and Objects when cloning in Cache.getJSON.
Fixes #2551.
2016-06-10 10:33:33 -05:00
photonstorm
0880380ea9 Phaser 2.4.9 RC4. 2016-06-10 16:22:54 +01:00
Richard Davey
1daf897b23 Small styling fixes. 2016-06-09 23:27:19 +01:00
Richard Davey
5415d9b603 Stage and Group postUpdate methods iterate the same way now. 2016-06-09 23:14:24 +01:00
Richard Davey
cd8bb5a216 Removed keyCode modifier (#2542) 2016-06-09 22:03:09 +01:00
Richard Davey
57642afc24 Fixed keyboard issue. 2016-06-09 20:55:21 +01:00
photonstorm
88f47e2497 Keyboard now uses a new internal method getKeyCode to normalize the key code value based on browser support. It first checks for event.key, then event.keyIdentifier and finally event.keyCode (thanks @SVasilev #2542) 2016-06-09 16:37:32 +01:00
photonstorm
2ac594ca03 TypeScript defs update. 2016-06-09 16:29:09 +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
28331c4f7f Comment fix. 2016-06-09 15:37:03 +01:00
photonstorm
458a67251d Fixed input property check. 2016-06-09 15:09:20 +01:00
photonstorm
90e1460320 Added new Debug.displayList function. 2016-06-09 14:58:58 +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
c64749fef2 Added missing properties. 2016-06-09 14:54:39 +01:00
photonstorm
92d3a5efa8 Adds a callback that is fired every time 'Pointer.processInteractiveObjects' is called.
The purpose of `processInteractiveObjects` is to work out which Game Object the Pointer is going to
interact with. It works by polling all of the valid game objects, and then slowly discounting those
 that don't meet the criteria (i.e. they aren't under the Pointer, are disabled, invisible, etc).

Eventually a short-list of 'candidates' is created. These are all of the Game Objects which are valid
for input and overlap with the Pointer. If you need fine-grained control over which of the items is
selected then you can use this callback to do so.

The callback will be sent 3 parameters:

1) A reference to the Phaser.Pointer object that is processing the Items.
2) An array containing all potential interactive candidates. This is an array of `InputHandler` objects, not Sprites.
3) The current 'favorite' candidate, based on its priorityID and position in the display list.

Your callback MUST return one of the candidates sent to it.
2016-06-09 14:49:10 +01:00
photonstorm
7c2d1d4ab8 Pointer.interactiveCandidates is a new Array that is erased and re-populated every time this Pointer is updated. It contains references to all of the Game Objects that were considered as being valid for processing by this Pointer, during the most recent update. To be valid they must have suitable a priorityID, be Input enabled, be visible and actually have the Pointer over them. You can check the contents of this array in events such as onInputDown, but beware: it is reset every update.
Pointer.swapTarget allows you to change the `Pointer.targetObject` object to be the one provided. This allows you to have fine-grained control over which object the Pointer is targeting.
2016-06-09 14:36:15 +01:00
photonstorm
fa43bec19f PIXI.DisplayObjectContainer.ignoreChildInput is a new property. If true then the children will _not_ be considered as valid for Input events. Because this has been applied to DisplayObjectContainer it means it's available in Group, Sprite and any other display level object. Using this boolean you can disable input events for all children in an entire Group, without having to iterate anything or deep-set flags.
InputHandler._pointerOverHandler and _pointerOutHandler have new arguments `silent` - if `true` then they will not dispatch any Signals from the parent Sprite.
2016-06-09 14:32:56 +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