Commit graph

139 commits

Author SHA1 Message Date
photonstorm
2cc8e57808 Fixed issue with the ScaleManager. 2014-09-01 08:19:43 +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
3e1eb10673 First pass at fully resizable canvas tracking and parenting. 2014-08-31 10:17:02 +01: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
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
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
Txus Ordorika
b952884d9d Fix for scale issues in CocoonJS using webgl renderer and screencanvas 2014-07-23 17:16:25 +02: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
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
photonstorm
a70a938505 docs fix 2014-07-09 05:38:59 +01:00
photonstorm
7c624f409f Updated console.log and README. 2014-07-03 10:50:26 +01:00
photonstorm
8c41f6cc10 Game.onBlur and Game.onFocus events are now dispatched regardless if Stage.disableVisibilityChange is true or false, so you can respond to these events without your game automatically pausing or resuming (#911) 2014-07-02 14:57:28 +01:00
photonstorm
58fc73348c The StateManager has a preRenderCallback option, which checks for a preRender function existing on the State, but it was never called. Have decided to add this in, so the core Game loop now calls state.preRender right before the renderer runs (thanks @AnderbergE #869) 2014-07-02 05:32:40 +01:00
photonstorm
db22b019be Swapped the ScaleManager creation order in Game, so both start and stop fullScreen requests work now. 2014-07-01 16:50:33 +01:00
photonstorm
ee5f6457c8 Swapped to using escaped Unicode characters for the console output. 2014-06-09 16:15:41 +01:00
photonstorm
b63900f669 Testing frame crop support. 2014-06-05 02:33:29 +01:00
photonstorm
1e9d0b2438 Tidying up. 2014-05-30 05:33:30 +01:00
photonstorm
6e8694d5f7 A Canvas style set from a game config object used an incorrect property (thanks @TatumCreative, fix #861) 2014-05-30 02:01:33 +01:00
photonstorm
edc1507b4e Resolved issue where Cocoon won't render a scene in Canvas mode if there is only one Sprite/Image on it. 2014-05-29 23:52:13 +01:00
photonstorm
eee1183a6a Forces use of a Canvas Renderer under CocoonJS automatically.
The SoundManager no longer requires a touch to unlock it, defaults to unlocked.
2014-05-29 23:17:18 +01:00
photonstorm
937085afda Added Uint32Array polyfill for BitmapData manipulation, and optional dataview polyfill for IE9 P2 requirements in the resources folder. 2014-04-29 02:09:58 +01:00
photonstorm
a5cbd8f2a6 Fixed an issue where Sounds that had been paused via game code would un-mute if the game paused and resumed. 2014-04-28 20:30:47 +01:00
photonstorm
1d48b3c5f2 Your State can now have a pauseUpdate method, which is called constantly when the game is paused.
The Input system is now updated even while the game is paused.
2014-04-28 00:07:40 +01:00
photonstorm
bcd64fd44b More Timer tests. 2014-04-26 16:16:18 +01:00
photonstorm
0f1e0a3d4e Updated the Device little / big endianess check. 2014-04-23 23:35:36 +01:00
photonstorm
b6cc150a15 Game.scratch is a single handy BitmapData instance that can be used as a visual scratch-pad, for off-screen bitmap manipulation (and is used as such by BitmapData itself).
Updated TS defs.
2014-04-23 22:14:47 +01:00
photonstorm
4ec5665148 Fixed #750 - Invalid typescript mapping for TileSprite.autoScroll function in TS defs.
Game checks if window.console exists before using it (should fix IE9 issues when dev tools are closed), however it is still used deeper in Pixi.
Body.loadData flagged as deprecated.
2014-04-22 23:31:07 +01:00
photonstorm
be52515ed4 PluginManager parent parameter removed as it's redundant. Also most core functions tidied up and jsdocs fixed. 2014-04-09 16:12:25 +01:00
photonstorm
01eec6cef5 Keyboard.stop nulls the function references after removing the event listeners (thanks @bmceldowney, #691) 2014-04-07 12:29:26 +01:00
photonstorm
bf32590cfe Fixed a few jsdoc errors. 2014-04-07 12:29:26 +01:00
photonstorm
f4dc686028 New build files for testing. 2014-04-01 16:13:00 +01:00
Ralph Smith
7e9fbd3c27 issue#661 update state before values are cleared
this prevent loosing state values related to physics bodys
and inputs before `state.update` is called.
2014-03-28 09:12:32 -05:00
Christian Wesselhoeft
debb6bdcf9 Fix jshint issues in src/core 2014-03-25 14:56:05 -07:00
photonstorm
111164e221 If no seed was given in the Game config object, the RandomDataGenerator wouldn't be started (thank tylerjhutchison fix #619) 2014-03-21 11:22:56 +00:00
photonstorm
e955145707 Added p2 kill and reset test + nearing completion on tilemap collision. 2014-03-13 21:14:18 +00:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
photonstorm
1966bfc0f8 Added in Game.focusLoss and focusGain methods and onBlur and onFocus signals to listen for. Made small time related fix and tested on iOS6 and iOS7 home screen button + lock button and all working fine. 2014-03-12 21:19:00 +00:00
photonstorm
fc788f909c P2 Body Begin and End Contact events done and working nicely. 2014-03-12 15:26:20 +00:00
photonstorm
d2762719b8 RandomDataGenerator is now started on Game creation instead of boot. You can pass a seed array in the game config object (feature request #547) 2014-03-12 13:53:30 +00:00
photonstorm
e6d520f983 Removed the coreUpdate Game loop stuff and reverted to previous method. 2014-03-12 13:45:30 +00:00
photonstorm
cb5a8c7515 Renamed px2p and p2px to: pxm and mpx (px to meters and meters to px). Also removed from Math. 2014-03-12 00:07:27 +00:00
photonstorm
83e197772d Moved Time update back into core loop. 2014-03-11 20:30:26 +00:00
photonstorm
e9ae465272 Sorted out Body gravity settings and updated the example. 2014-03-11 16:26:03 +00:00
photonstorm
6bddf1a914 The main Game class has been modified so that the update methods no longer have any if/else checks in them. Now split into coreUpdate, etc.
Put QuadTree back into Debug class.
Debug class now clears down on WebGL.
Updated RetroFont.type.
Fixed QuadTree example.
2014-03-11 16:14:01 +00:00