Commit graph

1534 commits

Author SHA1 Message Date
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
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
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
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
3d2cb3f8b3 Docs update. 2016-07-23 12:28:16 +01:00
Richard Davey
75272974e9 The Emitter.makeParticles collide argument didn't work, as a result of #2661, but is now properly respected thanks to that change (thanks @samme #2662) 2016-07-23 10:08:34 +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
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
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
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
020cb01056 Canvas tilemap renderer fixes. 2016-07-22 03:55:21 +01: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
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
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
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
0e24b1b946 Docs update. 2016-07-20 12:21:16 +01:00
Richard Davey
b8429b683e Docs update. 2016-07-20 12:21:16 +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
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
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
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
9aef9b741c Preparing for 2.6.2 dev. 2016-07-11 10:30:09 +01:00
photonstorm
1572a5313a README update. 2016-07-11 10:11: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
dfd9203e0a onWorldBounds now sends the bounds it collided with. 2016-07-08 11:28:45 +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
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
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
1b4d0330bf TypeScript updates. 2016-07-06 22:19:17 +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
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
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
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