Commit graph

1136 commits

Author SHA1 Message Date
photonstorm
918e00b868 Added Phaser.Keyboard.COMMA and Phaser.Keyboard.PERIOD to the consts list. 2015-07-09 14:31:18 +01:00
photonstorm
89c87bc9db Updated addKeys to take an object instead of 2 arrays - it's just cleaner and reads easier in code. 2015-07-09 14:28:58 +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
3590272c51 All Game Objects have a new boolean property called pendingDestroy. If you set this to true then the object will automatically destroy itself in the *next* logic update, rather than immediately. This is useful for cases when you wish to destroy an object from within one of its own callbacks, such as with buttons or other input events (thanks @alamboley #1748) 2015-07-08 18:52:01 +01:00
photonstorm
1b5da312d0 RandomDataGenerator.weightedPick has been tweaked slightly to allow for a more even distribution of weights. It still favors the earlier array elements, but will accurately include 'distance' elements as well (thanks @gingerbeardman #1751) 2015-07-08 17:20:36 +01:00
photonstorm
64b1794d67 Rope.segments used the wrong vertices property, causing a runtime error.
Debug.ropeSegments didn't take the scale of the Rope object into consideration, causing incorrect debug rendering.
2015-07-08 16:40:26 +01:00
photonstorm
b9dcf74726 If the device is detected as a Windows Phone the renderer is automatically set to use Canvas, even if WebGL or AUTO was requested (thanks @ramarro123 #1706) 2015-07-08 15:25:52 +01:00
photonstorm
0f31358724 Device.windowsPhone should now correctly identify Windows Phone 8.1 devices, which also think they are iOS and Androids. If you find a device that gets around this check please send us its ua string! (thanks @jounii #1496) 2015-07-08 15:22:32 +01:00
photonstorm
1281bc52d7 Setting the scaleMode property of a Game configuration object would cause a ScaleManager TypeError in the resize method. It now stores the scale mode locally and applies it after boot (thanks @Mickawesomesque #1534) 2015-07-08 14:52:20 +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
photonstorm
9548fb9856 Final textBounds updates. 2015-07-07 15:16:23 +01:00
Richard Davey
92f2742a26 When reusing a Tween created with an array of properties the values would get exponentially added to the TweenData internal array each time the tween was re-run (thanks @SBCGames #1747) 2015-07-07 04:21:55 +01:00
Richard Davey
6a9fd4de8d Debug.currentAlpha wasn't being used to set the alpha of the Debug context at all (was always set to 1) but now updates the alpha of the Debug context before anything is rendered to it (thanks @wayfu #1888) 2015-07-07 03:32:11 +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
Richard Davey
f57d3c19e9 P2.Body.createGroupCallback incorrectly referenced the _groupCallbackContext when deleting it (thanks @Langerz82 #1886) 2015-07-07 01:24:26 +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
photonstorm
ce405acb02 jsdoc update #1864 2015-07-02 13:31:26 +01:00
photonstorm
29f9eeabc6 RenderTexture now takes the display objects alpha into consideration when rendering it, before it would always reset worldAlpha to 1 before rendering, thus ignoring any alpha that may be set. 2015-07-02 13:28:44 +01:00
photonstorm
1ed33cb06c Setting mute to false on Sound that was never muted caused its volume to be set to zero (thanks @brianbunch #1870) 2015-06-24 15:54:25 +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
0258245f12 Phaser.Text no longer extends PIXI.Text but replaces it entirely. Phaser.Text now natively extends a Phaser Sprite, meaning it can be enabled for physics, damaged, etc. 2015-06-17 13:21:28 +01:00
photonstorm
102c74e121 Deprecated the following:
* Camera.screenView
* ScaleManager.maxIterations
* ScaleManager.enterPortrait (see onOrientationChange)
* ScaleManager.enterLandscape (see onOrientationChange)
* ScaleManager.enterFullScreen (see onFullScreenChange)
* ScaleManager.leaveFullScreen (see onFullScreenChange)
* ScaleManager.fullScreenFailed (see onFullScreenError)
* ScaleManager.checkResize
* ScaleManager.checkOrientation
* ScaleManager.setScreenSize (see updateLayout)
* ScaleManager.setSize (see reflowCanvas)
* ScaleManager.checkOrientationState (see reflowCanvas)
* ScaleManager.orientation (see screenOrientation)
* Gamepad.disabled (see enabled)
* Input.currentPointers (see totalActivePointers)
* Input.disabled (see enabled)
* Keyboard.disabled (see enabled)
* Mouse.disabled (see enabled)
* Mouse.mouseMoveCallback (see Input.addMoveCallback)
* MSPointer.disabled (see enabled)
* Touch.disabled (see enabled)
* Cache.getUrl (see getURL)
* Math.truncate (see Math.trunc)
* Math.snapToInArray (see Phaser.ArrayUtils.findClosest)
* Math.interpolateFloat (see Math.linear)
* Math.normalizeLatitude (use Phaser.Math.clamp(lat, -90, 90))
* Math.normalizeLongitude (use Phaser.Math.wrap(lng, -180, 180))
* Math.chanceRoll (use Phaser.Utils.chanceRoll)
* Math.numberArray (use Phaser.ArrayUtils.numberArray)
* Math.numberArrayStep (use Phaser.ArrayUtils.numberArrayStep)
* Math.limitValue (use Phaser.Math.clamp)
* Math.randomSign (use Phaser.Utils.randomChoice(-1, 1))
* Math.angleLimit (use Phaser.Math.clamp)
* Math.getRandom (use Phaser.ArrayUtils.getRandomItem)
* Math.removeRandom (use Phaser.ArrayUtils.removeRandomItem)
* Math.floor (use Math.trunc)
* Math.ceil (use Phaser.Math.roundAwayFromZero)
* Math.shift (use Phaser.ArrayUtils.rotate)
* Math.shuffleArray (use Phaser.ArrayUtils.shuffle)
* Math.distanceRounded (do the rounding locally)
* Canvas.getOffset (see Phaser.DOM.getOffset)
* Canvas.getAspectRatio (see Phaser.DOM.getAspectRatio)
* TilemapLayer.tileColor (use TilemapLayer.debugSettings.missingImageFill)
* Phaser.ArrayList alias removed, now use Phaser.ArraySet
* Utils.transposeArray (see Phaser.ArrayUtils.transposeMatrix)
* Utils.rotateArray (see Phaser.ArrayUtils.rotateMatrix)
* Utils.shuffle (see Phaser.ArrayUtils.shuffle)
2015-06-17 03:14:31 +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
b725c25702 Button game objects now have Input.useHandCursor set to true by default. 2015-06-17 01:55:36 +01:00
photonstorm
e28eb7b390 Docs update. 2015-06-17 01:55:36 +01:00
photonstorm
40802314dd TileSprite now fully supports animation again, having been broken for several versions due to a Pixi upgrade. We've updated the way TileSprites generate their textures internally considerably and animation support is back across both Canvas and WebGL as a result (#1653) 2015-06-17 01:25:56 +01:00
Richard Davey
14733e9b90 Tilemap.addTilesetImage can now accept a BitmapData as the key parameter and will use the BitmapData to render the tileset with instead of an image from the cache (thanks to @unstoppablecarl for the idea #1838) 2015-06-16 23:17:46 +01:00
photonstorm
30a35227da Formatting update. 2015-06-16 20:38:18 +01:00
photonstorm
17831e0103 P2.Body.loadPolygon now allows the key parameter to be passed as null - when this happens the object parameter can be the actual physics object data instead of a string pointing to the cache, allowing you to take advantage of adding multiple convex shapes with automatic adjustments for center of mass #1801 2015-06-16 19:02:28 +01:00
photonstorm
b481402ae4 Due to a Pixi 2 issue TileSprite when running under WebGL didn't respect the world alpha setting and would only work with its own alpha (thanks @hanenbro #1774) 2015-06-16 17:03:19 +01:00
photonstorm
1990bce48b Sound.restart and Sound.stop now properly disconnect the sound from the gainNode (or external node) before stopping it, allowing restart to work correctly (thanks @eofs #1796) 2015-06-16 16:24:47 +01:00
photonstorm
00cf44eb22 If running under Cordova and iOS the Game.lockRender boolean will be set to true when the game pauses and false when it resumes. This avoids the gpus_ReturnNotPermittedKillClient app crash on iOS (thanks @cncolder #1800) 2015-06-16 14:54:42 +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
photonstorm
f5369628ce Device.chromeVersion will return the major version number of Chrome. 2015-06-16 14:16:04 +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
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
2b0abb67dd onDragUpdate is a new signal that is dispatched whenever a Game object enabled for input and drag is moved by a pointer (i.e. during a drag event). See the Phaser.InputHandler.enableDrag docs for parameter details and the new Phaser Example. 2015-06-04 20:58:00 +01:00
photonstorm
eec99db8a9 Readme update. 2015-06-04 04:24:02 +01:00
photonstorm
ed82097151 Removed un-necessary PIXI.TextureCache pollution in Phaser.LoaderParser.bitmapFont. 2015-06-03 05:28:23 +01:00