Commit graph

136 commits

Author SHA1 Message Date
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
photonstorm
157df30696 Pointer button handling has been given an overhaul. It has the following new boolean properties: leftButton, rightButton, middleButton, backButton, forwardButton and eraserButton. So you can now easily check which buttons are active and build right or middle click support into your games. The Pointer object normalises these properties for you, regardless if they came from a MouseEvent or PointerEvent (thanks @youssefdetovernickr for the idea #1848) 2015-07-07 16:53:56 +01:00
Clark Stevenson
86c8704cd4 Handful of updates. Fixes #1877 thanks @sanchopancho13 2015-07-07 08:48:20 +01:00
Richard Davey
06658fa1e0 TilemapLayer.resize allows you to resize a TilemapLayer. It will update the internal canvas object and corresponding texture dimensions (#1881) 2015-07-07 03:27:28 +01:00
photonstorm
ab092c5c14 Keyboard.addKeys is a practical way to create an object containing user selected hotkeys. For example: addKeys( [Phaser.Keyboard.W, Phaser.Keyboard.S, Phaser.Keyboard.A, Phaser.Keyboard.D], [ 'up', 'down', 'left', 'right' ] ); would return an object containing the properties up, down, left and right that you could poll just like a Phaser.Key object. (thanks @Mourtz #1857) 2015-07-02 14:15:06 +01:00
photonstorm
698167a596 Tiled Image Collection support is now available and has been added to the TilemapParser and Tilemap classes (thanks @asyed94 #1879) 2015-07-02 13:53:02 +01:00
photonstorm
a89d48b9a6 Text.autoRound allows you to control if the text is allowed to render at sub-pixel coordinates or not. Set to true to round the coordinates, often eliminating anti-aliasing from certain font types (#1867) 2015-07-02 13:39:59 +01:00
Clark Stevenson
7ac7501a29 Updated TypeScript Definitions 2015-06-23 21:50:27 +01:00
photonstorm
a69c156526 The Text Bounds is a rectangular region that allows you to align your text within it, regardless of the number of lines of text or position within the world. For example in an 800x600 sized game if you set the textBounds to be 0,0,800,600 and text alignment to 'left' and vertical alignment to 'bottom' then the text will render in the bottom-right hand corner of the game, regardless of the size of font you're using or the number of lines in the text itself.
Set the Style properties `boundsAlignH` and `boundsAlignV` or adjust them via the Text setters to change the alignment.

It works by calculating the final position based on the Text.canvas size, which is modified as the text is updated. Some fonts have additional padding around them which you can mitigate by tweaking the Text.padding property.

Setting a textBounds _doesn't_ update the wordWrapWidth, so be aware of the relationship between the two.

Call this method with nothing defined for any of the parameters to reset an existing textBounds.

#1824
2015-06-17 17:18:04 +01:00
photonstorm
8cf28fede7 maxHealth is a new property that Game Objects with the Health component receive and works in combination with the heal method to ensure a health limit cap. 2015-06-17 02:00:04 +01:00
photonstorm
71cf2064ab Fixed TS defs and jsdoc for Ninja convertTilemap #1756 2015-06-16 19:10:01 +01:00
photonstorm
ab8c98676e Sound.resume wouldn't properly restart looped sounds in Chrome after being paused. Phaser now specifically handles the Chrome 42 bug and later fix (thanks @nkovacs #1820) 2015-06-16 14:28:46 +01:00
Clark Stevenson
ebd624b8e9 Minor Updates 2015-06-13 17:41:28 +01:00
photonstorm
732b80813e Line.rotate allows you to rotate a line by the given amount around its center point. 2015-06-13 05:20:43 +01:00
photonstorm
9e78cd1d7a Rectangle.random will return a uniformly distributed random point from anywhere within the rectangle. 2015-06-13 04:18:50 +01:00
photonstorm
77e7b2af9b Ellipse.random will return a uniformly distributed random point from anywhere within the ellipse. 2015-06-13 03:46:20 +01:00
photonstorm
3daea179fb Line.random will return a random point from anywhere on the Line segment. 2015-06-13 03:04:02 +01:00
photonstorm
fa469b85e1 Added GameObjectFactory.video url parameter. 2015-06-12 19:20:50 +01:00
photonstorm
7d308a2169 Added loadEvent parameter to Loader.video. 2015-06-12 19:19:43 +01:00
photonstorm
9212c01dae Returns a random point from anywhere within this circle. 2015-06-12 19:15:56 +01:00
photonstorm
af42f5d4c9 Cache.getJSON has a new parameter: clone. If set it will return a clone of the object stored in the Cache rather than a reference to it. 2015-06-12 12:16:58 +01:00
photonstorm
681d8679e7 Rectangle.resize allows you to resize a Rectangle to the new given dimensions without altering its position. 2015-06-11 06:01:29 +01:00
photonstorm
5458097006 Renamed createVideoStream to startMediaStream.
Refactored Video constructor significantly - you can no longer create a webcam stream from the constructor, as it doesn't give you time to respond to onAccess and onError signals in Firefox. Instead call startMediaStream directly having set-up your signal listeners first.

startMediaStream now has a chance to dispatch the onError signal if the webcam has been blocked entirely by the browser (auto-block or remembered block). autoPlay attribute removed to stop Firefox throwing a "Invalid URI. Load of media resource failed" error.

Tidied up Video.destroy to properly remove video element from the DOM.
2015-06-10 00:59:24 +01:00
Clark Stevenson
a8e2483bcf Minor Update. 2015-06-02 23:28:28 +01:00
photonstorm
76e2b00c82 Fixed pad jsdoc and ts defs (#1823) 2015-06-02 19:53:30 +01:00
Richard Davey
d0386ae493 Merge pull request #1827 from jamesgroat/dev
Fix cache.getKeys() definition.
2015-05-30 20:01:16 +01:00
jamesgroat
0e493a7102 Fix cache.getKeys() definition. 2015-05-29 19:20:10 -07:00
Clark Stevenson
aff5d1d2c5 Handful of updates to the definition files.
#1812 is fixed. (Note the comments are generated and not updated)
#1803 was fixed previously at some point it seems and required no work
2015-05-25 17:09:22 +01:00
Clark Stevenson
c5396eb39e 2.4.0 Definition Updates. 2015-05-09 02:58:55 +01:00
Clark Stevenson
548e022bc8 Updated typescript package for 2.4.0 2015-04-24 17:16:31 +01:00
Clark Stevenson
d6b597286b Minor phaser.d.ts the Timer callback methods have optional callbackContexts 2015-04-24 16:02:19 +01:00
Clark Stevenson
b175389c72 Merge remote-tracking branch 'clark/patch-3' into dev 2015-04-24 15:57:35 +01:00
Clark Stevenson
c4d4dc4bde Removed State.math
See #1759
2015-04-23 14:52:59 +01:00
Clark Stevenson
aa4ebab29d Update PIXI.d.ts generateTexture
Should fix #1719 ?
2015-04-20 16:27:35 +01:00