Commit graph

2534 commits

Author SHA1 Message Date
Chad Engler
43394300f7 change all Objects to any 2014-09-01 08:55:02 -07:00
Chad Engler
449e0a130b implement resize callback 2014-09-01 08:54:05 -07:00
Carlos Martinez
ec9a8b6903 Firxed for travis build. 2014-09-01 15:03:29 +01:00
Carlos Martinez
94f9c0906f this fixes the camera judders when following with float values. 2014-09-01 14:49:44 +01:00
Carlos Martinez
a869939bc3 Merge branch 'master' of https://github.com/photonstorm/phaser into dev 2014-09-01 14:20:15 +01:00
Carlos Martinez
9843818f30 Merge branch 'dev' of https://github.com/photonstorm/phaser into dev 2014-09-01 14:19:50 +01:00
Carlos Martinez
0640cc0c03 Added support to pass 2 array in Arcade collide and overlap (response to an issue). 2014-09-01 14:01:36 +01:00
photonstorm
8a1c22d059 New build files. 2014-09-01 08:21:40 +01:00
photonstorm
2cc8e57808 Fixed issue with the ScaleManager. 2014-09-01 08:19:43 +01:00
photonstorm
b389b73221 New build files for testing. 2014-09-01 03:56:40 +01:00
photonstorm
070e33f1e7 ArcadePhysics.overlap has been updated so that the Body.overlapX/Y properties are set to the amount the two bodies overlapped by. Previously they were zero and only populated during the separation phase, but now the data is available for just overlap checks as well. You can then use these values in your ovrelap callback as required - note that they are changed for every check, so a Sprite overlap tested against 10 other sprites will have the overlapX/Y values updated 10 times in a single collision pass, so you can only safely use the values in the callback (#641) 2014-09-01 03:54:55 +01:00
photonstorm
6784c3a50d TypeScript def updates to match new ScaleManager. 2014-09-01 03:40:26 +01:00
photonstorm
7fc37751b2 ScaleManager.orientationSprite has been removed because it never displayed correctly anyway (it would be distorted by the game scale), it will be bought back in a future version by way of a custom orientation state. 2014-09-01 03:30:02 +01:00
photonstorm
047839d806 Fixed preUpdate so that the offset is reset regardless of the RESIZE scaleMode. 2014-09-01 03:20:09 +01:00
photonstorm
8fec5169f0 Added Sound._muteVolume which stops Firefox and IE9 crashing if you try to unmute a sound that hasn't yet been muted, which can also happen as a result of a game visibility change (thanks @osmanzeki #1108 #1123) 2014-09-01 03:13:05 +01:00
photonstorm
80d1df4705 ScaleManager.setMinMax(minWidth, minHeight, maxWidth, maxHeight) is a handy function to allow you to set all the min/max dimensions in one call. 2014-09-01 03:07:17 +01:00
photonstorm
2f1f680d73 Docs fixes. 2014-09-01 02:59:24 +01:00
photonstorm
75d7fa1334 Updated Project Template to use new setResizeCallback method. 2014-09-01 02:52:45 +01:00
photonstorm
c6493b59c3 Removed use of _startHeight, left over from the Phaser v1 days that's no longer required. 2014-09-01 02:44:35 +01:00
photonstorm
fe9dbd15e5 The World bounds can now be set to any size, including smaller than the game dimensions. Before it was locked to a minimum size of the game canvas, but it can now be anything. 2014-09-01 02:41:07 +01:00
photonstorm
1a60d641b1 Canvas.removeFromDOM(canvas) will remove a canvas element from the DOM.
Game.destroy now removes the games canvas element from the DOM.
2014-09-01 02:38:21 +01:00
photonstorm
97d771c4e8 ScaleManager has a new scaleMode called RESIZE which will tell Phaser to track the size of the parent container (either a dom element or the browser window if none given) and set the canvas size to match it. If the parent changes size the canvas will resize as well, keeping a 1:1 pixel ratio. There is also a new ScaleManager.setResizeCallback method which will let you define your own function to handle resize events from the game, such as re-positioning sprites for a fluid responsive layout (#642)
The width and height given to the Phaser.Game constructor can now be numbers or strings in which case the value is treated as a percentage. For example a value of "100%" for the width and height will tell Phaser to size the game to match the parent container dimensions exactly (or the browser window if no parent is given). Equally a size of "50%" would tell it to be half the size of the parent. The values are retained even through resize events, allowing it to maintain a percentage size based on the parent even as it updates.
2014-09-01 01:52:04 +01:00
photonstorm
5fb8c7eb85 ScaleManager window.resize handler would constantly dispatch enterPortrait and enterLandscape events on window resizing, regardless if it actually entered that orientation or not.
Stage.offset has been moved to ScaleManager.offset
Stage.bounds has been removed, you can access it via Stage.getBounds.
Stage.checkOffsetInterval has been moved to ScaleManager.trackParentInterval
ScaleManager.hasResized signal has been removed. Use ScaleManager.setResizeCallback instead.
2014-09-01 01:02:48 +01:00
Richard Davey
b08bfec372 Fixed Key jsdocs #1157 2014-08-31 19:05:31 +01:00
photonstorm
004deff508 Note: This commit will break all input, don't pull it down until I finish this work off later today please!
Moved the DOM offset from Stage to ScaleManager (a more logical location for it) and updated Pointer to use that.
Moved the Pointer offset check to look at the ScaleManager.
Used getBoundingClientRect(), will see if that works better than Phaser.Canvas.getOffset.
2014-08-31 12:17:07 +01:00
photonstorm
8c7a699f74 Getting ready to test auto resizing renderer. 2014-08-31 11:09:27 +01:00
photonstorm
4d0cae0e2d jshint fixes for CocoonJS.App and continuing work on the new ScaleManager. 2014-08-31 10:17:02 +01:00
photonstorm
3e1eb10673 First pass at fully resizable canvas tracking and parenting. 2014-08-31 10:17:02 +01:00
Richard Davey
62eb127f6a Merge pull request #1156 from darfux/dev
Remove space between 'grunt' and '-cli' in CONTRIBUTING.md#making-changes
2014-08-31 10:09:36 +01:00
Richard Davey
37ddbf8612 Merge pull request #1155 from englercj/dev
More typescript definition file updates
2014-08-31 10:09:20 +01:00
darfux
7af05ca7f3 Remove space between 'grunt' and '-cli'
The command should be grunt-cli but not grunt -cli.
2014-08-31 13:15:20 +08:00
Chad Engler
e6f3bd5da6 more typescript definition file updates 2014-08-30 18:21:33 -07:00
photonstorm
e3f11d5aba change log update. 2014-08-31 00:21:47 +01:00
Richard Davey
e5cfa8202a Merge pull request #1154 from saikobee/issues/1153
Fixes #1153
2014-08-31 00:12:45 +01:00
Richard Davey
258e9d2646 Merge pull request #1152 from videlais/patch-5
CocoonJSApp 'onSuspended' and 'onActivated' events
2014-08-31 00:12:11 +01:00
Richard Davey
bc71d61734 Merge pull request #1151 from videlais/patch-4
CocoonJS doesn't support mouse wheel
2014-08-31 00:09:07 +01:00
Richard Davey
5cfb51b656 Merge pull request #1150 from videlais/patch-3
Detect CocoonJS.App
2014-08-31 00:02:28 +01:00
Richard Davey
daf7902aa9 Merge pull request #1148 from rhmoller/dev
p2.createContactMaterial() options parameter should be object
2014-08-31 00:01:04 +01:00
Brian Mock
fe94d7f002 Fixes #1153
Previously the `Phaser.Keyboard` module's `lastKey` property was of type
`string` in the TypeScript definition file, but it is actually a
`Phaser.Key` object, so `build/phaser.d.ts` has been updated to reflect
that.
2014-08-29 21:28:55 -07:00
Dan Cox
cccaa30459 CocoonJSApp 'onSuspended' and 'onActivated' events
This PR depends on [#1150] (https://github.com/photonstorm/phaser/pull/1150)!

(I apologize for all the different pull requests in a short time period. I finally got some time to do some development tonight and have been making my way through many of my TODO items.)

This adds support for CocoonJS.App's 'onSuspended' and 'onActivated' events, making it so that the timers and sounds are stopped/started and muted/unmuted when the user swaps an app from the background to the fore or the reverse.

Because neither ['onActivated'] (http://doc.ludei.com/2.0.2/CocoonJS_App/symbols/CocoonJS.App.html#.event:onActivated) nor ['onSuspended'] (http://doc.ludei.com/2.0.2/CocoonJS_App/symbols/CocoonJS.App.html#.event:onSuspended) send an Event object themselves, this patch fakes sending an object by creating one during the function call and giving it a 'type' property for visibilityChange() to check against.
2014-08-29 23:13:13 -04:00
Dan Cox
46c8fe3a09 CocoonJS doesn't support mouse wheel
CocoonJS hasn't implemented the "DOMMouseScroll" and "mousewheel" events.
2014-08-29 22:45:52 -04:00
Dan Cox
3f7f6fac2c Adjustment for JSLint 2014-08-29 22:33:33 -04:00
Dan Cox
c1872356fe Detect CocoonJS.App
There's a bit of a story behind this, but I'll try to keep it short.

While I've been working on a patch to detect Cordova's 'pause' and 'resume' events for Phaser.Stage's checkVisibilityChange(), I came across this [thread] (http://www.html5gamedevs.com/topic/8834-cocoonjs-pause-game-on-app-switch/) over on the forum. My hope, at the time, was that someone else would come along and write this patch and I could use their work to finish my own code. But, since that hasn't happened yet (and might never), I'm sending in this PR first for the check that establishes a 'game.device.cocoonJSApp' boolean that I plan to use later.
2014-08-29 20:58:19 -04:00
Rene Hangstrup Møller
4efac73ec6 p2.createContactMaterial() options parameter should be object 2014-08-29 23:02:03 +02:00
photonstorm
da5a9482f6 New build files for testing. 2014-08-29 18:13:33 +01:00
photonstorm
410cfd2d71 Code reformatting. 2014-08-29 18:06:01 +01:00
photonstorm
92386221e4 Tile.setCollision now adjusts the tiles interesting faces list as well, this allows you to create one-way jump tiles without using custom callbacks on a specific tile basis (thanks @RafaelOliveira #886) 2014-08-29 18:03:32 +01:00
photonstorm
5546e5903c Tiled polylines are now imported into the map objects property as well as map collision (#1117) 2014-08-29 16:56:30 +01:00
photonstorm
0284d0b98c If Time.elapsed was > Time.timeCap it would reset the elapsed value to be 1 / 60. It's now set to Time.timeCap and Time.timeCap defaults to 1 / 60 * 1000 as it's a ms value (thanks @casensiom #899) 2014-08-29 16:37:57 +01:00
photonstorm
10e7d8ff7e TilemapParser.getEmptyData now correct adds an empty bodies array into layers. This fixes an issue where p2 couldn't convert a csv map into collision tiles (thanks @sru #845) 2014-08-29 16:30:29 +01:00