Commit graph

767 commits

Author SHA1 Message Date
Gustav
5a1cb006ec beautified 2016-05-28 00:27:35 +02:00
Gustav
5b4b41c958 added functions for getting closest child and farthest child 2016-05-26 21:51:56 +02:00
zeterain
cd188ed0ab Update Documentation in Game.js
Updated the documentation in Game.js to indicate that the renderType property could be set to Phaser.HEADLESS.
2016-05-18 10:56:44 -06:00
photonstorm
02e8b1ae0a If you set Game.renderType to Phaser.HEADLESS it will no longer render the output to the canvas. The canvas is still created (although not added to the DOM), as it's required internally, but no rendering now takes place on it (thanks @ForgeableSum #2464) 2016-05-16 14:53:11 +01:00
photonstorm
16203a378a PIXI.defaultRenderer is now set to null in Game.destroy, allowing it to be reset if a new Game instance is created on the same page (thanks @xtforgame ##2474) 2016-05-11 11:27:36 +01:00
David Hayes
fb709fe728 Add a "shakeIntensity" property to Camera.
This would allow tweening the intensity of the Camera shake over the
lifetime of the shaking.
2016-04-22 19:53:52 -05:00
photonstorm
002d6250a8 Docs update. 2016-04-21 00:48:54 +01:00
photonstorm
3d6b1a3b7e Stopped the Camera Shake effect from changing the World position, as it screws up Arcade Physics, Sprite deltas and some input handling. Instead moved the effect to be render applied only. On Canvas it updates the context.setTransform call, and on WebGL the renderSession offset property. 2016-04-19 04:12:58 +01:00
photonstorm
62d135cf1f Small tidy-up. 2016-04-19 03:39:04 +01:00
photonstorm
5221bfd5da You can now pass in your own Canvas element to Phaser and it will use that instead of creating one itself. To do so you must pass a Game Configuration object to Phaser when you instantiate it, and set the canvas property of the config object to be the DOM element you wish to use, i.e.: { canvas: document.getElementById('yourCanvas') } (thanks @Friksel #2311) 2016-04-14 11:57:10 +01:00
photonstorm
7102a34706 Camera.flash is a new function that makes the camera 'flash' over the top of your game. It works by filling the game with the solid fill color specified, and then fading it away to alpha 0 over the duration given. This is great for things like hit effects. You can listen for the Camera.onflashComplete Signal.
Camera.fade is a new function that makes the camera fade to the color given, over the course of the duration specified. This is great for things like transitioning from one State to another. You can listen for the Camera.onFadeComplete Signal.

Camera.resetFX resets any active FX, such as a fade or flash and immediately clears it. Useful to calling after a fade in order to remove the fade from the Stage.

Phaser.Camera.ENABLE_FX is a const that controls if the Camera FX are available or not. It's `true` by default, but if you set it to `false` before boot then it won't create the Graphics object required to process the effects.
2016-04-09 04:05:07 +01:00
photonstorm
2ea94c83e6 Camera.shake is a new function that creates a camera shake effect. You can specify the intensity, duration and direction of the effect. You can also set if it should shake the camera out of bounds or not. 2016-04-09 02:57:16 +01:00
photonstorm
0b0a5d44cc Camera shake working and documented. 2016-04-09 02:49:18 +01:00
photonstorm
a916812db1 Camera shake support. 2016-04-09 02:01:45 +01:00
photonstorm
9e803fff7c Small fix. 2016-04-09 01:10:31 +01:00
photonstorm
dba84d5931 Camera has a new property: lerp. This is a Point object, that allows you to control the amount of horizontal and vertical smoothing to be applied to the camera when it tracks a Sprite. It works both with and without deadzones, and is turned off by default. Set it to low values such as 0.1 for really smooth motion tracking (thanks to @WombatTurkey for the idea of adding this) 2016-04-09 01:07:19 +01:00
photonstorm
e4a505d4b6 Lots of new Signals documentation. 2016-04-07 02:44:29 +01:00
photonstorm
896b32a28c SoundManager.muteOnPause is a new boolean that allows you to control if the Sound system gets muted automatically when a Phaser game pauses, such as when it loses focus. You may need to set this to false if you wish to control the audio system from outside of your Phaser game, i.e. from DOM buttons or similar (#2382) 2016-04-06 02:09:22 +01:00
photonstorm
0c2ac47981 Camera.position would return the view rectangles centerX/Y coordinates, instead of view.x/y (which is what Camera.x/y returns), so it has been updated to return view.x/y instead (thanks @kamparR #2120) 2016-04-06 00:18:01 +01:00
photonstorm
ecbff44354 Group.getByName searches the Group for the first instance of a child with the name property matching the given argument. Should more than one child have the same name only the first instance is returned. 2016-04-05 23:59:05 +01:00
photonstorm
65f8f111c8 Game.forceSingleUpdate is now true by default. 2016-04-05 23:40:15 +01:00
photonstorm
b762e1dc55 Added jsdocs warning re: #2045 2016-04-05 23:28:02 +01:00
photonstorm
4c3a30a6f6 PluginManager.destroy is now called by Game.destroy. 2016-04-05 23:16:52 +01:00
photonstorm
aee0212e11 Camera.follow now uses the Targets world property to seed the camera coordinates from, rather than its local position. This means Sprites that are members of offset Groups, or transformed display lists, should now be followed more accurately (thanks @rbozan #2106) 2016-04-05 23:04:31 +01:00
photonstorm
f40cfbe2ae 2015 - 2016. 2016-04-04 22:16:16 +01:00
Rafael Barbosa Lopes
dd51a1724e Ensure a parent container is a Group before removing from its hash. 2016-03-24 13:44:49 -03:00
photonstorm
ede6806e41 The default state of the internal property _boundDispatch in Phaser.Signal is now false, which allows for use of boundDispatches (thanks @alvinlao #2346) 2016-02-26 13:40:35 +00:00
fillmoreb
b1c74e694e Update World.js
Phaser.World.centerX and Phaser.World.centerY only worked if the bounds had an origin of 0,0.  This change takes into account the actual origin.
2016-02-25 11:58:22 -07:00
photonstorm
0b5a4391f1 StateManager.destroy now sets clearCache and clearWorld internally before clearing the current state, as otherwise they would have been left untouched, such as from Game.destroy (thanks @i-dimitrov #2138) 2016-02-18 13:10:54 +00:00
photonstorm
46cc05a377 Groups now check for child.parent before calling removeFromHash (thanks @spayton #2323 #2338) 2016-02-18 12:29:01 +00:00
Richard Davey
989d53ecba Undo #1993 2016-02-09 14:01:04 +00:00
Richard Davey
30b563085b The z property assigned to children of a Group now starts from zero instead of 1, this is an internal change mostly but if you relied on the z property for some reason then please be aware of this (thanks pantoninho) 2016-02-09 11:31:46 +00:00
Richard Davey
eff10cec71 Moved the width / height floor into the ScaleManager (#2329) 2016-02-08 23:09:16 +00:00
Richard Davey
1ac287f9d3 Merge pull request #1993 from nickryall/retina-fullscreen
Fix for fullscreen retina ( Desktop )
2016-02-04 18:31:50 +02:00
photonstorm
9787474c6e Camera.checkBounds now takes the scale of the Camera into account (thanks @ForGorNorPor #2263) 2016-02-04 16:26:18 +00:00
Richard Davey
2cd76b7617 Docs update (#2166) 2016-02-04 00:13:32 +00:00
Richard Davey
ecb68c2fca JSDocs update. 2016-02-03 23:53:09 +00:00
Richard Davey
a0eb44ec09 Group.add and Group.addAt would forget to remove the child from the hash of its previous Group if it had a physics body enabled, causing unbounded hash increase (thanks @strawlion @McIntozh #2232) 2016-02-03 21:51:01 +00:00
Richard Davey
3bc8dcd154 The width and height values passed to the Game constructor are now passed through Math.floor first. This ensures you can never create a game width non-integer dimensions, which has all kinds of implications - from browser performance to breaking things like TileSprite rendering (#2262) 2016-02-03 19:11:26 +00:00
Richard Davey
2d2101adcb Both transparent and antialias were ignored if set to false in a Game configuration object, as the parseConfig method didn't check for falsey values (thanks @amadeus #2302) 2016-02-03 12:28:12 +00:00
Richard Davey
4e3c764207 Merge pull request #2248 from 06wj/dev
Fixed ScaleManager EXACT_FIT not working
2016-02-02 17:42:54 +02:00
Richard Davey
b3da35163a Merge pull request #2151 from jaminscript/logic-fix
Remove unnecessary variable
2016-02-01 19:16:02 +02:00
Richard Davey
1d2d707b32 Merge pull request #2168 from nlotz/dev
fix typos in API docs
2016-02-01 19:01:58 +02:00
Richard Davey
13cf12d08a Merge pull request #2297 from nexiuhm/master
loadUpdate() now gets a last update when loading is complete.
2016-02-01 18:20:19 +02:00
Richard Davey
8795792047 Merge pull request #2289 from staff0rd/grammar_fix
fixed grammar on update() comment
2016-02-01 18:18:05 +02:00
nexiuhm
bc00f924a7 Added a check to avoid calling the function when doing dynamic loading after state is created. 2016-01-14 17:23:52 +01:00
nexiuhm
1c65c48341 onLoadUpdate now recives the last ( 100 ) update. 2016-01-14 17:09:41 +01:00
zeterain
9edec8da57 Update documentation in ScaleManager.js
Documentation for ScaleManager.compatibility mis-spelled the supportsFullScreen property.
2016-01-11 09:02:07 -07:00
Stafford Williams
16517cc773 fixed grammar on update() comment 2016-01-08 20:29:58 +11:00
墨水
ba0683b4d0 Fixed ScaleManager EXACT_FIT not working 2015-12-09 09:55:40 +08:00
photonstorm
83948f5882 Updated Filter docs (#2223) 2015-11-20 17:01:05 +00:00
nlotz
da45d04a70 fix typos in API docs 2015-10-27 09:10:14 +01:00
Ben Abbott
1dadaf5590 Remove unnecessary variable
This commit removes an unnecessary variable which was defined, populated but never used.
2015-10-22 13:47:06 +13:00
Richard Davey
e6aa9f83c9 Typo fix. 2015-10-19 23:18:23 +01:00
photonstorm
8e4dc1f078 ScaleManager.getParentBounds now checks if parentNode has an offsetParent before calling getBoundingClientRect on it (thanks @McFarts #2134) 2015-10-13 12:04:57 +01:00
photonstorm
c79a341c58 Fixed jshint errors. 2015-10-12 12:23:48 +01:00
photonstorm
e01a754732 Removed the FrameDebugger and moved to its own branch. 2015-10-12 11:10:37 +01:00
Richard Davey
3d5fac1817 Merge pull request #2111 from jdnichollsc/master
Takes any transforms into account to get the correct parent bounds
2015-10-06 19:08:02 +03:00
photonstorm
9013107fd1 The ScaleManager no longer creates a Phaser.FlexGrid if the class isn't available (i.e. excluded via a custom build) 2015-09-30 11:20:00 +01:00
photonstorm
6fd2b6a7ec Phaser.Create no longer automatically creates a BitmapData object when it starts. It now only does it when you first make a texture or grid. 2015-09-30 11:18:53 +01:00
Juan David Nicholls Cardona
8ce70cbeb4 Takes any transforms into account to get the correct parent bounds 2015-09-25 15:42:29 -05:00
Richard Davey
cffc90ebbc Merge pull request #2107 from JackMorganNZ/master
Corrected spelling: 'mainted' to 'maintained'
2015-09-23 11:21:21 +03:00
Jack Morgan
589b9b8edd Corrected spelling: 'mainted' to 'maintained' 2015-09-23 12:03:54 +12:00
Richard Davey
d86d01bd25 Camera.setBoundsToWorld only adjusts the bounds if it exists (thanks @prudolfs #2099) 2015-09-20 21:07:28 +01:00
photonstorm
b011146a87 Fixed lint errors. 2015-09-16 13:55:33 +01:00
photonstorm
e64f9647db Better output. Need to fix jshint errors next. 2015-09-16 13:36:53 +01:00
photonstorm
09e8d465e4 Lots more work on the FrameDebugger. Just need texture preview and then can test it properly. 2015-09-16 13:17:06 +01:00
Richard Davey
61edd1b458 FrameDebugger can now handle Text and BitmapText. 2015-09-16 03:18:15 +01:00
Richard Davey
b89f6dd3b4 Much improved final output and logging process. 2015-09-16 02:25:57 +01:00
Richard Davey
29b4bb3174 :) 2015-09-16 02:25:40 +01:00
photonstorm
3be0ed8849 FrameDebugger now hooked into Canvas Renderer. Better output coming. 2015-09-15 16:14:14 +01:00
photonstorm
4125e42a06 Sorted out setting the Stage backgroundColor. Much more concise now. 2015-09-15 13:34:07 +01:00
photonstorm
ff254ec33b Added clearBeforeRender boolean. 2015-09-15 12:53:44 +01:00
photonstorm
0ee95b22d6 Fixed rogue comma. 2015-09-15 12:53:44 +01:00
photonstorm
b99c9e22ec Removed PIXI.Stage. Phaser.Stage now handles everything it needs to do. 2015-09-15 12:53:44 +01:00
photonstorm
705cacf2ca Sorting out the Stage background color assignment so we can drop a boolean check in the render method. 2015-09-15 12:53:43 +01:00
photonstorm
5a1a918a5d Added FrameDebugger.
Tidying up the renderer constructors.
2015-09-15 12:53:43 +01:00
photonstorm
06ed961e81 Added FrameDebugger into the mix. 2015-09-15 12:53:43 +01:00
photonstorm
8db23545da jsdoc updates. 2015-09-10 15:57:55 +01:00
photonstorm
90a500ec1e Game.update could call updateLogic multiple times in a single frame when catching up with slow device frame rates. This would cause Tweens to advance at twice the speed they should have done (thanks @mkristo)
Time.desiredFpsMult is a pre-calculated multiplier used in Game.update.

Time.refresh updates the `Time.time` and `Time.elapsedMS` values and is called automatically by Game.update.
2015-09-09 12:09:18 +01:00
photonstorm
2de83328d9 Testing Tween timer fix. 2015-09-08 17:44:28 +01:00
Richard Davey
38eca4d5b9 Filter.addToWorld allows you to quickly create a Phaser.Image object at the given position and size, with the Filter ready applied to it. This can eliminate lots of duplicate code. 2015-09-03 00:46:47 +01:00
photonstorm
8833a509eb jsdoc fix. 2015-09-02 16:16:52 +01:00
photonstorm
32b0c98f7a Group.resetChild is a new method that allows you to call both child.reset and/or child.loadTexture on the given child object. This is used internally by getFirstDead and similar, but is made public so you can use it as a group iteration callback. Note that the child must have public reset and loadTexture methods to be valid for the call.
Group.getFirstDead, Group.getFirstAlive and Group.getFirstExists all have new optional arguments: `createIfNull`, `x`, `y`, `key` and `frame`. If the method you call cannot find a matching child (i.e. getFirstDead cannot find any dead children) then the optional `createIfNull` allows you to instantly create a new child in the group using the position and texture arguments to do so. This allows you to always get a child back from the Group and remove the need to do null checks and Group inserts from your game code. The same arguments can also be used in a different way: if `createIfNull` is false AND you provide the extra arguments AND a child is found then it will be passed to the new `Group.resetChild` method. This allows you to retrieve a child from the Group and have it reset and instantly ready for use in your game without any extra code.
2015-08-28 12:23:48 +01:00
Paul
26a6338072 Change splice.call(arguments, ..) to use slice
- Bypasses issue of usage incorrectly omitting 2nd argument to `splice`

- More clear of intent; `slice` does not modifify `arguments`

- `slice` is faster across all desktop browsers, by varying degrees
  - Probably due to parameter-aliasing and de-opts when modified.
  - Both `slice` and `splice` create a new Array object
2015-08-26 23:50:16 -07:00
nickryall
57aaf23238 Fix for fullscreen retina 2015-08-09 20:32:04 +12:00
Brice Thomas
ef536d276a doc(Signal): fix typo 2015-08-06 13:34:14 +02:00
photonstorm
b365ebf570 jshint fix. 2015-08-03 16:45:03 +01:00
photonstorm
f4a1f11429 PIXI.CanvasPool is a new static global created to deal with the issue of resource leaks and continuous DOM node build-up when creating lots of Text or BitmapData objects, or when calling generateTexture on any display object. The CanvasPool will do its best to re-use out dated canvas elements rather than filling up the DOM with new ones.
Sprite.setTexture has a new `destroyBase` parameter - set this to `true` if you know the base used a generated texture that isn't being used by any other sprites. This will free-up the canvas for further re-use by other calls to generateTexture or Text objects.
2015-08-03 16:09:16 +01:00
photonstorm
e901fb80f6 Merging in the CanvasPool changes to the core. 2015-08-03 14:46:55 +01:00
photonstorm
98ae410c34 Removed use of the deprecated enterFullScreen and leaveFullScreen signals from the Scale Manager (thanks @mmanlod #1972) 2015-08-03 11:44:00 +01:00
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
photonstorm
8eb34f96ce WebGL context loss and restoration is now handled directly by Phaser.
Cache.clearGLTextures empties out all of the GL Textures from Images stored in the cache. This is called automatically when the WebGL context is lost and then restored.
2015-07-22 12:59:32 +01:00
photonstorm
f15fe6706c All undefined argument checks were changed from if (typeof x === 'undefined') to if (x === undefined) removing the typeof check and saving some bytes across the codebase in the process. 2015-07-22 10:37:15 +01:00
Richard Davey
9e38bf974a World.stateChange is a new method that is called whenever the state changes or restarts. It resets the world x/y coordinates back to zero and then resets the Camera.
Sprites with Arcade Physics bodies that had `collideWorldBounds` enabled would be moved to the wrong position if you restarted a State (or swapped to a new State) that reset the world bounds (thanks @vulvulune #1775)
2015-07-22 01:24:26 +01:00
Richard Davey
5e33a2ea92 TS defs updates for the Cache changes. 2015-07-15 23:22:51 +01:00
Richard Davey
4dec046c40 Added pendingDestroy to Groups. 2015-07-12 11:33:30 +01:00
Richard Davey
1850e287bd Merge pull request #1899 from spayton/updev
Removed use of deprecated signals (enterLandscape & enterPortrait)
2015-07-10 17:09: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