Commit graph

405 commits

Author SHA1 Message Date
photonstorm
2f1f680d73 Docs fixes. 2014-09-01 02:59:24 +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
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
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
photonstorm
26a55bd202 SoundManager.destroy is a new method that will destroy all current sounds and reset any callbacks.
StateManager.clearCurrentState now handles the process of clearing down the current state and is now called if the Game is destroyed.
Game.destroy now clears the current state, activating its shutdown callback if it had one. It also now destroys the SoundManager, stopping any currently running sounds (#1092)
2014-08-29 11:37:47 +01:00
Richard Davey
ffb413b741 Fixed issue with callbacks not having the correct context. 2014-08-28 21:54:30 +01:00
photonstorm
0c88ba041a If you used a single Game configuration object and didn't specify the enableDebug property it would crash on Debug.preUpdate (thanks @luizbills #1053) 2014-08-28 04:19:10 +01:00
photonstorm
6e2cd37776 ScaleManager.destroy now removes the window and document event listeners, which are no longer created anonymously (thanks @eguneys #1092)
Input.Gamepad.destroy now destroys all connected SinglePads and clears event listeners.
SinglePad.destroy now clears all associated GamepadButton objects and signals.
2014-08-28 03:31:47 +01:00
photonstorm
fa45d7feff Events.onDestroy is a new signal that is dispatched whenever the parent is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
Group.onDestroy is a new signal that is dispatched whenever the Group is being destroyed. It's dispatched at the start of the destroy process, allowing you to perform any additional house cleaning needed (thanks @jonkelling #1084)
2014-08-28 02:56:06 +01:00
photonstorm
d7f8950758 Debug.cameraInfo no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
Camera.setBoundsToWorld no longer crashes if the camera bounds are nulled (thanks @wayfu #1143)
2014-08-28 02:13:51 +01:00
Richard Davey
50179d76fb Merge pull request #1015 from Zielak/dev
Phaser.Camera.position for quick access
2014-08-28 02:02:40 +01:00
Richard Davey
6a314a60d1 Merge pull request #1142 from darfux/dev
Fixed Group.removeBetween's default endIndex bug
2014-08-28 01:44:01 +01:00
Richard Davey
cc69a4bf2c Merge pull request #1127 from FedeOmoto/dev
Game configuration object "renderer" property wrongly assigned to Game.r...
2014-08-28 01:36:49 +01:00
darfux
abdf54858c Fixed Group.removeBetween's default endIndex bug 2014-08-26 21:02:13 +08:00
Alvin
c7e256245a Merge pull request #1107 from gamedolphin/test
Fixed Point.rotate bug . Also added a little documentation for world wrap.
2014-08-22 12:32:06 +02:00
Federico Omoto
14028cafbc Game configuration object "renderer" property wrongly assigned to Game.renderer 2014-08-21 17:57:07 -03:00
Dan Cox
fbd2de5b23 Cordova 'deviceready' event check
A slightly obnoxious but necessary hack to prevent a race condition between the loading of Apache Cordova and Phaser itself. 

Without waiting for the 'deviceready' event, Phaser can often load first, preventing any console messages from appearing to the user. Because Cordova writes to the platform's console (via CordovaLog), it must first be loaded and signal its own 'deviceready' event before console or plugin usage can occur. Otherwise, all messages and functionality is ignored.
2014-08-21 00:11:41 -04:00
Sandeep Nambiar
9977d5e204 World Wrap and P2
Changes only to documentation for clarity.
2014-08-13 04:10:37 +05:30
Sam MacPherson
3b69c7ede1 group swap fix 2014-08-05 19:39:21 -04:00
Txus Ordorika
b952884d9d Fix for scale issues in CocoonJS using webgl renderer and screencanvas 2014-07-23 17:16:25 +02:00
Richard Davey
d8c755a544 Merge pull request #1017 from devinb83/dev-codepaused
codePaused should be set if manually called
2014-07-18 11:57:37 +01:00
photonstorm
24527eac3e Group.checkAll allows you to check if the same property exists across all children of the Group and is set to the given value (thanks @codevinsky #1013)
Group.checkProperty allows you to check if the property exists on the given child of the Group and is set to the value specified (thanks @codevinsky #1013)
Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013)
Phaser.Utils.setProperty will set an Objects property regardless of depth (thanks @codevinsky #1013)
Phaser.Utils.getProperty will get an Objects property regardless of depth (thanks @codevinsky #1013)
2014-07-18 11:52:39 +01:00
Richard Davey
3da788bd1d Merge pull request #1013 from codevinsky/group-checkall
added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phase...
2014-07-18 11:37:38 +01:00
Johan Rosén
ba62326ce7 OritentationSprite fix, not using PIXI.TextureCache anymore 2014-07-16 17:07:53 +02:00
Darek Zieliński
64ae6c6ba7 "Reuse a single Point object rather than creating a new one each time" 2014-07-15 18:32:20 +02:00
Richard Davey
afb379f2dd Merge pull request #1024 from lucbloom/if-onShutDownCallback
Add a check around this optional function
2014-07-15 16:21:35 +01:00
photonstorm
538425193a World.wrap when using the bounds of the object wouldn't adjust the bounds correctly, meaning wrapping outside the camera failed (thanks @jackrugile #1020) 2014-07-15 14:22:24 +01:00
Richard Davey
f77b4d4e8f Merge pull request #1014 from Dumtard/dev
Group create was not creating with p2 debug flag
2014-07-15 12:39:53 +01:00
Luc Bloom
f1cb146c10 Add a check around an optional function
My game crashes here if I update phaser.js to a new version. It happens
when my game switches to another State object.
2014-07-15 13:02:44 +02:00
photonstorm
f78a527ad5 Prevented objects with pixel perfect checks from over-riding other higher priority ID items (#983)
Rebuilt the way items are polled for Pointer events (drag, click, move). Now faster and more efficient, especially when some items in the stack require pixel perfect checks.
2014-07-15 11:20:57 +01:00
devinb83
4a632ed3a0 codePaused should be set if manually called
If pause is called manually, codePaused should be set regardless of whether the game is currently paused or not. This would fix issues where a developer might not want the game to automatically resume when the screen regains focus.
2014-07-14 12:57:37 -07:00
Darek Zieliński
852054b772 Plus validation of non-point objects 2014-07-14 20:09:22 +02:00
Charles Black
7107d73188 group create with p2 debug 2014-07-14 14:05:44 -04:00
Darek Zieliński
ee1df55d84 Added position Point object for quick x/y coordinates access. 2014-07-14 20:03:34 +02:00
jdowell
aad74ff4d5 added: Phaser.Utils.getProperty / Phaser.Utils.setProperty; added: Phaser.Group.checkAll
Added deep-property getting and setting via strings:

Phaser.Util.getProperty(someObj, 'foo.bar.baz');

Phaser.Util.setProperty(someObj, 'foo.bar.baz', 'lol');

Added a "checkAll" method to Phaser.Group that returns true/false if all of the children's given properties match the value passed in.

this.someGroup.checkAll('foo.bar.baz', 'lol'); // will return true if child[n].foo.bar.baz === 'lol'

Comes with standard 'force' ability.
2014-07-14 12:33:13 -05:00
photonstorm
2c421d27ce GameObjectFactory.spriteBatch now lets you specify null as a parameter for the parent and automatically adds the batch to game.world as a result. Also fixed jsdocs issues (@petarov #1000) 2014-07-14 12:56:05 +01:00
photonstorm
74679922d1 Debug.preUpdate was still being called in the Game Loop even if enableDebug was set to false (thanks @qdrj, #995) 2014-07-11 11:52:48 +01:00
photonstorm
d11d8051b1 You can now prevent the Debug class from being created or booted by using the Game configuration setting: enableDebug. By default it is true, set to false to prevent the class from being created. Please note you are responsible for checking if this class exists before calling it, but you can do that via if (game.debug) { ... } (request #984) 2014-07-10 10:46:18 +01:00
photonstorm
a182598c65 Using a Game configuration object you can now specify the value of the preserveDrawingBuffer flag for the WebGL renderer. By default this is disabled for performance reasons. But if you need to be able to take screen shots of your WebGL games using toDataUrl on the game canvas then you'll need to set this to true (#987) 2014-07-10 10:46:18 +01:00
jackrugile
42df8356e7 Added options to disable horizontal and vertical world wrapping individually 2014-07-10 00:05:50 -06:00
photonstorm
a70a938505 docs fix 2014-07-09 05:38:59 +01:00
Alvin
7031d9ccc1 Fixed typo 2014-07-07 18:19:02 +02:00
photonstorm
7c624f409f Updated console.log and README. 2014-07-03 10:50:26 +01:00