Commit graph

169 commits

Author SHA1 Message Date
Christoph Dörfel
2623ddeaf7 Convenience function to remove a collision group from a P2 Body 2015-08-30 00:19:37 +02:00
photonstorm
32b0c98f7a Group.resetChild is a new method that allows you to call both child.reset and/or child.loadTexture on the given child object. This is used internally by getFirstDead and similar, but is made public so you can use it as a group iteration callback. Note that the child must have public reset and loadTexture methods to be valid for the call.
Group.getFirstDead, Group.getFirstAlive and Group.getFirstExists all have new optional arguments: `createIfNull`, `x`, `y`, `key` and `frame`. If the method you call cannot find a matching child (i.e. getFirstDead cannot find any dead children) then the optional `createIfNull` allows you to instantly create a new child in the group using the position and texture arguments to do so. This allows you to always get a child back from the Group and remove the need to do null checks and Group inserts from your game code. The same arguments can also be used in a different way: if `createIfNull` is false AND you provide the extra arguments AND a child is found then it will be passed to the new `Group.resetChild` method. This allows you to retrieve a child from the Group and have it reset and instantly ready for use in your game without any extra code.
2015-08-28 12:23:48 +01:00
Vladislav Forsh
fb299b8838 Fixed few typos in typings 2015-08-27 13:56:49 +03:00
Vladislav Forsh
3b71baff7d Fixed typos in typings for CachedImage 2015-08-27 13:53:22 +03:00
timotei
5ec7d7e4c9 Fix TypeScript addKeys declaration
Since we expect an object that's `any`
instead of an array `any[]`
2015-08-27 11:21:57 +03:00
Richard Davey
0689395aa9 Merge pull request #2033 from clark-stevenson/dev
Minor TypeScript definition edits.
2015-08-26 23:30:38 +03:00
Clark Stevenson
77329e7889 Minor TypeScript definition edits. 2015-08-26 19:07:56 +01:00
Milkey Mouse
91997662b4 Fixed TypeScript definition for replaceRGB
BitmapData.replaceRGB's 'region' argument should be optional.
2015-08-25 17:37:58 -07:00
photonstorm
486c15f16f New docs. 2015-08-24 15:43:45 +01:00
photonstorm
bf862964d2 Phaser 2.4.3 Release. 2015-08-24 13:55:00 +01:00
photonstorm
22f7aacfcb Added frameBased to the TweenManager and made Tween.frameBased reference that setting, allowing you to set it once (#2015) 2015-08-20 12:59:06 +01:00
Richard Davey
4c55dddba6 Merge pull request #1998 from cloakedninjas/dev
Adding missing event handlers in Typescript definitions
2015-08-18 15:17:49 +03:00
Vladislav Forsh
6b6c58230b Fixed typescript definitions. cache.getRenderTexture() actually returns not just texture but Object with texture and frame. 2015-08-11 20:29:10 +03:00
cloakedninjas
6d9240b176 Adding missing event handlers in Typescript definitions 2015-08-11 15:56:56 +01:00
Richard Davey
7fbeb1c062 BitmapData.line draws a line to the BitmapData in the color and thickness specified.
Lots of BitmapData updates to use local vars and 'op' property, cutting down code size.
2015-08-07 02:48:00 +01:00
Richard Davey
7588e123c7 Line.centerOn will position the Line so that its midpoint lays on the coordinates given. 2015-08-07 01:40:37 +01:00
Richard Davey
614b84e2ea * Line.rotateAround allows you to rotate a Line around the given coordinates (in world space)
* Point.rotate uses a faster and simpler rotation function when no distance argument is specified.
* Line.rotate used a calculation method which resulted in the line growing (or shrinking) in length over time, the more it was rotated. The new method never changes the lines length.
2015-08-07 01:35:31 +01:00
photonstorm
8e7b717a50 Line.midPoint will return a Point object where the x and y values correspond to the center (or midpoint) of the Line segment. 2015-08-06 17:10:39 +01:00
Richard Davey
62c87052cb Merge pull request #1985 from yahiko00/master
Extra documentation and TypeScript definition file update
2015-08-06 14:20:26 +01:00
yahiko
aaeb45e8fe - Update Phaser.Cache.addImage() signature
- Update Phaser.Cache.getImage() signature
- Add Phaser.CachedImage interface
2015-08-06 13:08:53 +02:00
Clark Stevenson
d63d9c4792 Added a couple of missing types 2015-08-01 12:08:21 +01:00
Clark Stevenson
d7deb2ac0e Updated TypeScript Readme 2015-08-01 12:06:25 +01:00
Richard Davey
cbc68ab4c9 Merge pull request #1950 from jdnichollsc/dev
Added Text.addFontStyle and Text.addFontWeight
2015-07-31 16:00:47 +01:00
photonstorm
d23e5d6eba BitmapText.smoothed is a new boolean property that allows you to set texture smoothing on a bitmap font or not. By default smoothing is always on, but you can turn it off which helps for bitmap fonts created from pixel art style character sets. 2015-07-31 15:58:00 +01:00
photonstorm
fc83dc6bdf Tween.frameBased allows you to control if a Tween updates based on the physics step (i.e. frame based) or the system clock (time based). A frame based tween will use the physics elapsed timer when updating. This means it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should be given in frames. If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween has actually been through. 2015-07-30 15:27:51 +01:00
photonstorm
c032d57183 Loader.images is a new method that allows you to pass an array of image keys, and optionally the urls, to the Loader and have them all added to the load queue in one go. 2015-07-30 15:01:52 +01:00
vrecluse
f68f25afb2 Fix mismatched typescript member function signature of Phaser.Point.rotate. 2015-07-30 10:59:42 +08:00
photonstorm
4b22f48c75 2.4.2 release. 2015-07-29 15:01:04 +01:00
Juan David Nicholls Cardona
655013da1b Added Text.addFontStyle and Text.addFontWeight allows you to set styles and weights font within the Text. 2015-07-28 02:05:08 -05:00
Richard Davey
50480d815f * Cache.getFrame has a new cache parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.getFrameCount has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.getFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.hasFrameData has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.getFrameByIndex has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)
* Cache.getFrameByName has a new `cache` parameter (that defaults to the Image cache, but can be changed to any other)

re: #1935
2015-07-26 13:14:25 +01:00
Richard Davey
19c9ee747a Merge pull request #1927 from shivinsky/dev
Add missing renderTabLine return type.
2015-07-24 17:52:07 +01:00
photonstorm
9401755ab9 Phaser 2.4.1 docs. 2015-07-24 13:30:46 +01:00
Alexander
dfe11ff7ea Add missing renderTabLine return type. 2015-07-23 00:57:14 +03:00
photonstorm
858ad51610 Phaser 2.4 release. 2015-07-22 15:31:30 +01:00
photonstorm
ffaa7d711f Removed BaseTextureCache requirement from BitmapData.
Fixed jshint.
Updated TS defs.
2015-07-22 13:23:40 +01:00
Clark Stevenson
10366210cf Mostly Additions based on Components. 2015-07-20 21:38:50 +01:00
Clark Stevenson
8221883c99 Update Definition File 2015-07-17 01:08:45 +01:00
photonstorm
7271eb5e2d Removed un-needed cache arguments and fixed jshint error. 2015-07-16 14:58:51 +01:00
Richard Davey
bab50d7c88 * The Cache has been internally refactored considerably. Image data is now all stored in the same object, rather than being split across the PIXI global caches (such as PIXI.TextureCache and PIXI.BaseTextureCache), which are no longer used by Phaser.
* Internally the Cache now uses a single _cache object, which is partitioned to store the various different object types. Before the cache used lots of private objects, one per data type, but it's now a lot cleaner and we've managed to cut out hundreds of lines of duplicate code in the process.
* Cache.getImage has a new argument which lets you return either just the HTML Image element or the entire image cache object, which includes the baseTexture and frame data.
* Cache.getImage will return a __default image if the key isn't given, or a __missing image if the key is given but not found in the cache. This means it will always return a valid image and no longer cause Phaser to throw runtime errors deeper down with invalid image objects.
2015-07-16 00:46:28 +01:00
Richard Davey
5e33a2ea92 TS defs updates for the Cache changes. 2015-07-15 23:22:51 +01:00
Richard Davey
502dd548fb Loader.path is a string and if set it is placed before any _relative_ file path given to the Loader. For example: load.path = "images/sprites/"; followed by load.image("ball", "ball.png"); and load.image("tree", "level1/oaktree.png"); would load the ball file from images/sprites/ball.png and the tree from images/sprites/level1/oaktree.png. The path is added before the filename but *after* the Loader.baseURL. The path _must_ end with a "/". Set it to nothing to disable the path. 2015-07-12 23:43:35 +01:00
photonstorm
d3525950a2 Group.addMultiple if given a Group.children array as the first parameter would fail as the original group length was decreased out of line with the children being added. Group.addMultiple now checks if the children argument is a Phaser.Group instance, and if so it uses Group.moveAll instead on it (thanks @AnderbergE #1898)
Group.moveAll allows you to move all of the children of a Group into another Group.
2015-07-10 17:05:54 +01:00
Richard Davey
f65bca1026 All Signals now have the ability to carry extra custom arguments with them, which are passed on to the callback you define after any internal arguments. For example a Phaser.Key has an onDown signal. When dispatched onDown sends a reference to the Key as the first and only argument. But you can now set the callback like this: fireKey.onDown.add(shoot, this, 0, 'lazer', 64). So when the onDown signal is dispatched internally the callback (shoot in this case) will receive 3 arguments: the Key reference that is raised internally and the string 'lazer' and value 64, which were the custom arguments provided when setting-up the callback. 2015-07-09 21:15:00 +01:00
photonstorm
918e00b868 Added Phaser.Keyboard.COMMA and Phaser.Keyboard.PERIOD to the consts list. 2015-07-09 14:31:18 +01:00
photonstorm
5ad3698703 BitmapData.clear has 4 new optional parameters: x, y, width and height, that define the area to be cleared. If left undefined it works exactly the same as before and clears the entire canvas. 2015-07-09 11:44:21 +01:00
Richard Davey
d027bf8ba7 BitmapData.generateTexture will take a snapshot of the BitmapDatas canvas at that moment in time and convert it into an Image, which is then stored in the Phaser image Cache based on the key given. You can then use the new texture for any future sprites or texture based objects. 2015-07-09 00:19:07 +01:00
Richard Davey
6e116a0816 TS defs updated for pendingDestroy. 2015-07-08 19:09:42 +01:00
photonstorm
3012e49937 Text.addColor would incorrectly color the text stroke if set (thanks @llevkin #1893
Text.addStrokeColor works in the same way as `Text.addColor` but allows you to define a color stop for the stroke color instead of the fill color.
2015-07-08 12:52:39 +01:00
Richard Davey
86cac2085c BitmapData.move(x, y) allows you to shift the contents of the BitmapData horizontally and vertically by the given amounts. The image wraps-around the edges of the BitmapData.
BitmapData.moveH(distance) allows you to horizontally shift the BitmapData with wrap-around the edges.

BitmapData.moveV(distance) allows you to vertically shift the BitmapData with wrap-around the edges.
2015-07-08 04:26:28 +01:00
Richard Davey
a7e18137d1 Text has a new style property: tabs. This allows you to specify a pixel value (or values) that allows you to space out text that contains tab characters within it. Text.tabs can be either an integer, in which case all tabs share the same spacing, or an array of pixel values corresponding exactly to the number of tabs per line of text. This allows you to easily align columns of data in a single Text object. 2015-07-08 01:15:31 +01:00