Commit graph

111 commits

Author SHA1 Message Date
photonstorm
0054dc996b The Loader now directly calls StateManager.loadComplete rather than the StateManager listening for the loadComplete event, because Loader.reset unbinds this event (and it's easy to accidentally remove it too)
Loader.onLoadComplete is dispatched *before* the Loader is reset. If you have a `create` method in your State please note that the Loader will have been reset before this method is called. This allows you to immediately re-use the Loader without having to first reset it manually.
2015-02-10 17:04:04 +00:00
photonstorm
c154b8c785 Loader.resetLocked is a boolean that allows you to control what happens when the loader is reset, *which happens automatically on a State change*. If you set resetLocked to true it allows you to populate the loader queue in one State, then swap to another State without having the queue erased, and start the load going from there. After the load has completed you could then disable the lock again as needed.
Loader.reset has a new optional 2nd parameter `clearEvents` which if set to `true` (the default is false) will reset all event listeners bound to the Loader.
2015-02-10 11:58:17 +00:00
photonstorm
2cb9ea312b extension URL fix, jsdoc fix and small format changes. 2015-02-09 20:27:47 +00:00
Paul
367d976061 Loader: documentation
- Corrected some documentation wrt. parallel downloading
2015-02-08 20:40:54 -08:00
Paul
b63f6873e5 Loader: better audio selection
- Fixed bug where `.` in query portion of URI could throw off
  auto-detection
- Allow `Loader#audio` to accept `{uri..,type..}` objects to blobs (and
  data) URIs can also be used to auto-format detection / fallbacks.
2015-02-08 20:22:09 -08:00
Paul
86dc43874c Loader: enabled parallel-by-default
- Minor cleanup to parallel: enabled by default, limit of 4 (hard-limit
  max 12)
2015-02-08 19:42:34 -08:00
Paul
8d61441844 Merge remote-tracking branch 'upstream/dev' into wip-loader
- Added changes/support for 'blob:' uri's in upstream, extended to 'data:'
- Added upstream documentation
- Some small fixes for XHD from upstream

Conflicts:
	src/loader/Loader.js
2015-02-08 19:42:22 -08:00
Mark Wecke
3a70677a05 use XDomainRequest in Loader.xhrLoad 2015-02-06 13:52:24 +01:00
Richard Davey
41d9a42a02 Merge pull request #1565 from abtion/master
Fix CORS loading BitmapFonts with IE9
2015-02-03 21:14:45 +00:00
jeppester
b29d2b8b23 Missing semicolons added 2015-01-24 19:48:52 +01:00
jeppester
242e3cc7c3 Indentation errors fixed 2015-01-24 19:43:49 +01:00
jeppester
d7cd76efe7 More cosmetic changes 2015-01-24 18:36:58 +01:00
jeppester
a722293786 Cosmetic pull request preparations 2015-01-24 18:31:02 +01:00
jeppester
067dcc4332 Fix CORS loading BitmapFonts with IE9 2015-01-23 17:17:50 +01:00
photonstorm
48f590c180 Added tools links. 2015-01-10 00:30:13 +00:00
photonstorm
801f387f75 Updated docs. 2015-01-08 01:28:38 +00:00
aressler38
c9984633b5 fixing documentation typo 2014-12-15 14:12:09 -08:00
aressler38
f1bdd174b2 [ISSUE 1458] Allow BLOB urls when loading audio files 2014-12-15 12:57:30 -08:00
Paul
e8da5e73f8 Loader - IE9 XDR used for all XHR when requested
Previously XHD was special-cased for 'json' file assets, but not all JSON
requests. Now it is used for all XHR transfers when `useXDomainRequest` is
enabled.

If XDR is used outside of IE 9 then a warning is emitted to the console.
The `useXDomainRequest` property has also been deprecated

This may address consistency issues as mentioned in
https://github.com/photonstorm/phaser/issues/1361
2014-11-28 04:21:17 -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
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
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
Paul
930fc46649 Loader 2014-11-20 17:51:30 -08:00
photonstorm
7c9dfefc8f Loader resize handler. 2014-11-11 14:00:07 +00:00
photonstorm
da87c75e00 Loader.useXDomainRequest used to be enabled automatically for IE9 but is now always set to false. Please enable it only if you know your server set-up / CDN requires it, as some most certainly do, but we're finding them to be less and less used these days, so we feel it's safe to now disable this by default (#1248)
Loader.json was using the wrong context in IE9 with XDomainRequest calls (thanks @pnstickne #1258)
2014-10-27 12:31:55 +00:00
photonstorm
f0b7670506 Fixed an issue where audio files with query strings after them would fail the canPlayAudio checks (thanks Vithar) 2014-10-17 18:50:12 +01:00
spayton
eeeb6c3733 This stops Phaser progressing with file loads when an audio file file
failed in IE.

The problem was that it was calling fileComplete everytime instead of
setting it as a callback.
2014-10-02 16:48:12 +01:00
Richard Davey
01fd3df434 AudioSprite support is now built into the Loader and SoundManager. AudioSprites are like sprite sheets, only they consist of a selection of audio files and markers in a json configuration. You can find more details at https://github.com/tonistiigi/audiosprite (thanks @codevinsky #1205)
Fixed AudioSprite jsdoc, casing and formatting issues.
2014-09-23 22:15:09 +01:00
Jeremy Dowell
7cce1366f2 jshint cleanup 2014-09-23 10:25:49 -05:00
Jeremy Dowell
dd0d1729ad Phaser.AudioSprite
AudioSprite implementation for phaser.

Loads audio sprites based on the file format created with: https://github.com/tonistiigi/audiosprite
2014-09-23 10:21:29 -05:00
photonstorm
5980a3bdc6 Loader can now natively load XML files via load.xml. Once the XML file has loaded it is parsed via either DOMParser or ActiveXObject and then added to the Cache, where it can be retrieved via cache.getXML(key).
Cache now has support for XML files stored in their own container. You can add them with `cache.addXML` (typically this is done from the Loader automatically for you) and get them with `cache.getXML(key)`. There is also `cache.checkXMLKey(key)`, `cache.checkKeys` and `cache.removeXML(key)`.
2014-09-19 13:45:04 +01:00
photonstorm
20551f9129 Lots of jsdocs fixes ready for the new doc generator. 2014-09-16 17:35:08 +01:00
photonstorm
5e6c40e392 Fixed the jsdocs and crop method used on preloader sprites. 2014-09-09 12:48:38 +01:00
photonstorm
34426e7560 Loader.useXDomainRequest boolean automatically set to true if the browser is specifically detected as IE9, but you can still override this. IE10 will use xhr. 2014-08-28 05:24:57 +01:00
photonstorm
7bfa6fa9f2 Loader.useXDomainRequest boolean added. If true (the default is false) it will use XDomainRequest when loading JSON files instead of xhr. In rare IE edge-cases this may be required. You'll know if you need it (#1131 #1116) 2014-08-28 01:23:45 +01:00
photonstorm
122640e01b Phaser.Loader was incorrectly getting the responseText from _xhr instead of _ajax on IE9 xDomainRequests (thanks @lardratboy #1050) 2014-07-21 11:12:58 +01:00
mjeffery
fcc23ef5d2 fixed onPackComplete Signal 2014-07-13 15:38:13 -04:00
photonstorm
2293b64c94 Removing debug / console.log output. 2014-07-09 05:49:13 +01:00
photonstorm
3d80568e4c Loader.isLoading is set to false if the filelist size is zero. 2014-06-30 09:24:25 +01:00
photonstorm
5b5bdc80d9 Loader.pack will allow you to load in a new Phaser Asset Pack JSON file. An Asset Pack is a specially structured file that allows you to define all assets for your game in an external file. The file can be split into sections, allowing you to control loading a specific set of files from it. An example JSON file can be found in the resources folder and examples of use in the Phaser Examples repository.
Loader.totalQueuedPacks returns the number of Asset Packs in the queue.
Loader.totalLoadedPacks returns the number of Asset Packs already loaded.
2014-05-29 17:05:13 +01:00
photonstorm
4004cc92e3 First working pass at the Asset Pack Loader update. 2014-05-29 15:57:47 +01:00