Commit graph

3212 commits

Author SHA1 Message Date
Paul
5f9025f800 Sprite/Time - lifespan based on physicsTime
- Lifespan is updated based on physics time which makes this consistent
  with fixed-step updates and tweens, etc.
2014-11-25 00:33:13 -08:00
Paul
fb6e602d60 Time - documentation
- Updating documentation for clarity, esp. wrt the now / elapsed /
  physicsTime.

- Marked elapsedMS as deprecated as it is just elapsed based on Date.now
  instead of the high-res timer; both provide roughly equivalent behavior,
  with elapsedMS just falling back to worse-case behavior.
2014-11-25 00:33:06 -08:00
photonstorm
0d9678e512 Promoted Game time loop count to protected public var. Checked in Sprite.lifespan decrement to avoid over-decreasing the lifespan (#1358) 2014-11-25 02:50:39 +00:00
photonstorm
b3ccdf6914 Replaced screen shot. 2014-11-25 02:49:42 +00:00
photonstorm
1ef0f0a9fe Rounded off bounds. 2014-11-25 02:49:34 +00:00
photonstorm
aa86d2fbf3 Phaser 2.2.0 RC11 Build files. 2014-11-25 00:48:53 +00:00
photonstorm
aa68e9433d Grunt task updates. 2014-11-25 00:48:40 +00:00
photonstorm
abea71fdcb 2.2.0 RC11 Docs Export. 2014-11-25 00:24:31 +00:00
photonstorm
c9996f41b0 Tidying up. 2014-11-25 00:24:29 +00:00
photonstorm
54e79f5b25 Grunt and docs updates. 2014-11-25 00:24:29 +00:00
photonstorm
7de47fd80a Template update. 2014-11-25 00:24:29 +00:00
photonstorm
1a313415e3 Tidying up. 2014-11-25 00:24:29 +00:00
photonstorm
04160c31b0 Moved docgen into the Resources folder. 2014-11-25 00:24:29 +00:00
photonstorm
f8a1632450 Grunt task updates. 2014-11-25 00:24:28 +00:00
photonstorm
c4b81ff6ea jsdoc fixes. 2014-11-25 00:24:28 +00:00
photonstorm
0e73a6428a RC11. 2014-11-25 00:24:28 +00:00
photonstorm
2579a67d78 RequireJS Template fix. 2014-11-25 00:24:28 +00:00
Richard Davey
6247a19180 Merge pull request #1360 from clark-stevenson/dev
Definition Updates
2014-11-24 16:08:12 +00:00
Clark Stevenson
3c860a4ad5 Definition Updates 2014-11-24 15:53:47 +00:00
Richard Davey
386c6df4fc Merge pull request #1359 from pnstickne/wip-optimize-signal
Signal - memory optimization / reductions
2014-11-24 13:35:29 +00:00
photonstorm
5b757eaee7 jshint fix 2014-11-24 13:15:38 +00:00
Paul
e62442bcb7 Signal - memory optimization / reductions
There are a fair amount of Signal objects created. In the current
implementation these are somewhat "fat" objects for two reasons:

- A closure / ad-hoc `dispatch` is created for each new Signal - this
  increases the retained size by 138+ bytes/Signal in Chrome.

- There are a number of instance variables that never change from their
  default value, and the bindings array is always created, even if never
  used.

This change "lightens" the Signals such that there is significantly less
penalty for having many (unusued) signals.

As an example of how much this _does_ play a role, in the "Random Sprite"
demo ~2000 Signals are created, with only 12 of these signals being
subscribed to. This results in a shallow size of ~300K and a retained size
of ~600K (which is almost as much memory as required by the
Sprites/Sprites themselves!) for .. nothing.

With these changes the shallow and retained sizes are less than 50K each -
and this is with only ~200 sprites!

This change addresses these issues by

- Changing it so there is _no_ `dispatch` closure created. This is a
  _breaking change_ (although there is no usage of such in core where it
  breaks); the code referenced "#24", but no such issue could be found on
  github.

  In the rare case that code needs to obtain a dispatch-closure, the
  `boundDispatch` property can be used to trivially obtain a (cached)
  closure.

- The properties and default values are moved into the prototype; and the
  `_bindings` array creation is deferred. This change, coupled with the
  removal of the automatic closure, results in a very lightweight
  ~24bytes/object (in Chrome) for unbound signals.

This is minor breaking change, as per the removal of the automatic
closure; but no such need/usage was found in the core. (There may be cases
in the examples, which were not checked.)

If merely opting for the array creation delay and keeping the default
properties in the prototype the shallow size is still halved; less
significant but still a consideration.
2014-11-24 04:55:29 -08:00
photonstorm
2d50334cd3 Updated lifeSpan to use elapsedMS instead. 2014-11-24 12:54:39 +00:00
photonstorm
aa62eb94fc Added Time.elapsedMS (as Time.elapsed isn't always an ms value) 2014-11-24 12:54:27 +00:00
photonstorm
06b2a2c6a0 Added Tween.generateData back in, now all the Particles and Tween examples work properly. 2014-11-24 12:34:42 +00:00
photonstorm
af8167258e Moving doc build to grunt. 2014-11-24 11:12:09 +00:00
photonstorm
4ecd7f99a8 Docs update. 2014-11-24 11:12:09 +00:00
Richard Davey
c2a4a7b3f8 Merge pull request #1357 from pnstickne/wip-optimize-group2
Group - fix extreme 'forEach' de-optimization
2014-11-24 10:56:58 +00:00
Paul
beeda75ff5 Signal - object optimizations
Optimizing object creation, mainly of the backing array in situations when
there is no backing array.
2014-11-24 02:43:56 -08:00
Paul
859e8f9f07 Group - fix extreme 'forEach' de-optimization
This de-optimization occurred between 2.0.7 and 2.1.0 and is currently
present through dev.

`Group.forEach`, which is used by QuadTree, had an extreme de-optimization
in assigning to `arguments` - _CPU profiling showed as much as 50% of the
time was used by Group.forEach_ (after the correction it is not
registered) due to this de-optimization making the "When Particles
Collide" demo run with an unsatisfactory performance, even on a Desktop.

The fix uses a separate array and push (which is optimizable; the previous
implementation was not optimizable in Chrome, FF, or IE!).

This also fixes usages of `slice(arguments,..); ushift` elsewhere in
Group, using the same convention. It applies the same update for `iterate`
as does https://github.com/photonstorm/phaser/pull/1353 so it can also
accept null/undefined for `args` from the invoking functions.
2014-11-24 01:55:16 -08:00
Paul
6aa5d9ba90 Loader - prep/cleanups
- Cleaned up abnormal case handling
- Disabled parallel loading by default; it can be enabled with
  `enableParallel`.
- Minor quibbles
- Removed unused `dataLoadError`
2014-11-23 11:02:24 -08:00
photonstorm
0ff7fbbe42 Merged latest Pixi fixes. 2014-11-23 12:47:55 +00:00
photonstorm
1928427bcb Phaser TypeScript defs fixes. 2014-11-23 11:32:13 +00:00
Paul
d8227cdceb Loader - documentation
Additional documentation updates.
2014-11-22 20:57:42 -08:00
Paul
1062b7330e Loader - fix/update for getAssetIndex
Loaded/loading assets are skipped if they have been superceded. This makes
the behavior consistent with respect to `addToFileList`, if the queue is
inspected or modified while loading.
2014-11-22 17:42:12 -08:00
Paul
d94321702a Loader - corrected tag error handling 2014-11-22 15:09:07 -08:00
Paul
609d77faba Loader - added means to add synchronization points
- Added `withSyncPoint` and `addSyncPoint` methods to allow explicit
  adding of synchronization points (synchronization points are explained
  in `withSyncPoint`.

- Changed the file/asset `sync` attribute to `syncPoint` to reflect
  terminology.
2014-11-22 14:42:27 -08:00
Paul
a6116b3832 Loader - fixes
- `onLoadComplete` will fire, even when loading is interrupted
- Context default to `this` on application.
2014-11-22 13:55:32 -08:00
Paul
9995edbe3f Loader - documentation
Updated/corrected various documentation.
2014-11-22 13:53:51 -08:00
Paul
7889739485 Loader - added enabledParallelDownloads
Added method to enable/disable parallel downloading in general.
2014-11-22 13:49:18 -08:00
Paul
1c000949cb Loader - transformUrl
Pulled out baseURL extension into method.
2014-11-22 13:46:14 -08:00
Paul
68f436ace8 Group - additional documentation refinement
General tidying/corrections of Group documentation.
2014-11-22 01:29:19 -08:00
Paul
946bb19dd7 Group - 'iterate' documentation and guard
Update iterate documentation to cover usage of `args` and added a guard so
that the callback can be used without requiring that `args` is specified.

Ref. https://github.com/photonstorm/phaser/issues/1352
2014-11-22 00:55:52 -08:00
Paul
7116d0716d Loader - fast image-from-cache path
Employee the use of image.complete and a width/height check to detect when
it is available "from cache" and skip having to run though the
onload/onerror cases.
2014-11-21 22:38:32 -08:00
Paul
b00c4ad222 Loader - state bug fixes
More updates for https://github.com/photonstorm/phaser/issues/1330

Fixed several issues with state clearing (or lack of) resulting in
incorrect behavior if the loader was re-used.
2014-11-21 12:06:44 -08:00
Paul
4d16af0e0f Loader - parallel loading
Parallel loading is now supported, configured by
`loader.concurrentRequestCount`. Each file (a pack is now considered a
type of file) asset can be marked with `sync`, which is done for both pack
files and script files.

When a `sync` asset is encountered it must be loaded before any previous
resource any following resource is loaded (but it doesn't have to wait for
previous resources). Pack files are an exception in that they can download
(but are not processed) and they can fetch-around other `sync` assets.

Because of the concurrent nature there is no guarantee of the order in
which the individual events will file in relation to eachother, but local
ordering (e.g. onFileError always before onFileComplete) and overall
ordering (e.g. onLoadStart .. onFile? .. onLoadComplete) is preserved.

There is also increased error hardening and a few previous edge-cases
fixed (and likely a few bugs added).
2014-11-21 10:58:00 -08:00
photonstorm
874f60c1bc Removed CocoonJS hack - woohoo! 2014-11-21 10:40:18 +00:00
Paul
930fc46649 Loader 2014-11-20 17:51:30 -08:00
photonstorm
69b57073f2 Added missing duration parameter. 2014-11-20 21:19:09 +00:00
photonstorm
7e4a494f13 Keyboard.justPressed has bee renamed to Keyboard.downDuration which is a much clearer name for what the method actually does.
Keyboard.justReleased has bee renamed to Keyboard.upDuration which is a much clearer name for what the method actually does.
Keyboard.downDuration, Keyboard.upDuration and Keyboard.isDown now all return `null` if the Key wasn't found in the local keys array.
2014-11-20 20:55:51 +00:00