Skip to content

Commit bf9146e

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents 8529cb9 + 4c13b9a commit bf9146e

57 files changed

Lines changed: 2271 additions & 372 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/loader/LoaderPlugin.js

Lines changed: 327 additions & 29 deletions
Large diffs are not rendered by default.

src/loader/filetypes/AnimationJSONFile.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ var AnimationJSONFile = function (key, url, path, xhrSettings)
3131
*
3232
* The file is **not** loaded immediately after calling this method.
3333
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
34-
*
35-
*
3634
*
3735
* @method Phaser.Loader.LoaderPlugin#animation
3836
* @since 3.0.0

src/loader/filetypes/AtlasJSONFile.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@ var AtlasJSONFile = function (key, textureURL, atlasURL, path, textureXhrSetting
3333
return { texture: image, data: data };
3434
};
3535

36+
/**
37+
* Adds a Texture Atlas file to the current load queue.
38+
*
39+
* Note: This method will only be available if the Atlas JSON File type has been built into Phaser.
40+
*
41+
* The file is **not** loaded immediately after calling this method.
42+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
43+
*
44+
* @method Phaser.Loader.LoaderPlugin#atlas
45+
* @since 3.0.0
46+
*
47+
* @param {string} key - The key of the file within the loader.
48+
* @param {string} textureURL - The url to load the texture file from.
49+
* @param {string} atlasURL - The url to load the atlas file from.
50+
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
51+
* @param {object} atlasXhrSettings - Optional atlas file specific XHR settings.
52+
*
53+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
54+
*/
3655
FileTypesManager.register('atlas', function (key, textureURL, atlasURL, textureXhrSettings, atlasXhrSettings)
3756
{
3857
// Returns an object with two properties: 'texture' and 'data'

src/loader/filetypes/AudioFile.js

Lines changed: 18 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
9595
var audioConfig = game.config.audio;
9696
var deviceAudio = game.device.audio;
9797

98-
/**
99-
* [description]
100-
*
101-
* @method Phaser.Loader.FileTypes.AudioFile#
102-
* @since 3.0.0
103-
*
104-
* @param {[type]} (audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData) - [description]
105-
*
106-
* @return {[type]} [description]
107-
*/
10898
if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData))
10999
{
110100
console.info('Skipping loading audio \'' + key + '\' since sounds are disabled.');
@@ -113,68 +103,44 @@ AudioFile.create = function (loader, key, urls, config, xhrSettings)
113103

114104
var url = AudioFile.findAudioURL(game, urls);
115105

116-
/**
117-
* [description]
118-
*
119-
* @method Phaser.Loader.FileTypes.AudioFile#
120-
* @since 3.0.0
121-
*
122-
* @param {[type]} !url - [description]
123-
*
124-
* @return {[type]} [description]
125-
*/
126106
if (!url)
127107
{
128108
console.warn('No supported url provided for audio \'' + key + '\'!');
129109
return null;
130110
}
131111

132-
/**
133-
* [description]
134-
*
135-
* @method Phaser.Loader.FileTypes.AudioFile#
136-
* @since 3.0.0
137-
*
138-
* @param {[type]} deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio) - [description]
139-
*
140-
* @return {[type]} [description]
141-
*/
142112
if (deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio))
143113
{
144114
return new AudioFile(key, url, loader.path, xhrSettings, game.sound.context);
145115
}
146-
/**
147-
* [description]
148-
*
149-
* @method Phaser.Loader.FileTypes.AudioFile#
150-
* @since 3.0.0
151-
*
152-
* @return {[type]} [description]
153-
*/
154116
else
155117
{
156118
return new HTML5AudioFile(key, url, loader.path, config, game.sound.locked);
157119
}
158120
};
159121

160-
// When registering a factory function 'this' refers to the Loader context.
161-
//
162-
// There are several properties available to use:
163-
//
164-
// this.scene - a reference to the Scene that owns the GameObjectFactory
165-
122+
/**
123+
* Adds an Audio file to the current load queue.
124+
*
125+
* Note: This method will only be available if the Audio File type has been built into Phaser.
126+
*
127+
* The file is **not** loaded immediately after calling this method.
128+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
129+
*
130+
* @method Phaser.Loader.LoaderPlugin#audio
131+
* @since 3.0.0
132+
*
133+
* @param {string} key - [description]
134+
* @param {string|string[]} urls - [description]
135+
* @param {object} config - [description]
136+
* @param {object} xhrSettings - [description]
137+
*
138+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
139+
*/
166140
FileTypesManager.register('audio', function (key, urls, config, xhrSettings)
167141
{
168142
var audioFile = AudioFile.create(this, key, urls, config, xhrSettings);
169143

170-
/**
171-
* [description]
172-
*
173-
* @method Phaser.Loader.FileTypes.AudioFile#
174-
* @since 3.0.0
175-
*
176-
* @param {[type]} audioFile - [description]
177-
*/
178144
if (audioFile)
179145
{
180146
this.addFile(audioFile);
@@ -229,29 +195,11 @@ FileTypesManager.register('audio', function (key, urls, config, xhrSettings)
229195

230196
AudioFile.findAudioURL = function (game, urls)
231197
{
232-
/**
233-
* [description]
234-
*
235-
* @method Phaser.Loader.FileTypes.AudioFile#
236-
* @since 3.0.0
237-
*
238-
* @param {[type]} urls.constructor !== Array - [description]
239-
*/
240198
if (urls.constructor !== Array)
241199
{
242200
urls = [ urls ];
243201
}
244202

245-
/**
246-
* [description]
247-
*
248-
* @method Phaser.Loader.FileTypes.AudioFile#
249-
* @since 3.0.0
250-
*
251-
* @param {[type]} var i = 0; i < urls.length; i++ - [description]
252-
*
253-
* @return {[type]} [description]
254-
*/
255203
for (var i = 0; i < urls.length; i++)
256204
{
257205
var url = GetFastValue(urls[i], 'uri', urls[i]);

src/loader/filetypes/AudioSprite.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,26 @@ var CONST = require('../const');
33
var FileTypesManager = require('../FileTypesManager');
44
var JSONFile = require('./JSONFile.js');
55

6-
// Phaser.Loader.FileTypes.AudioSprite
7-
6+
/**
7+
* Adds an Audio Sprite file to the current load queue.
8+
*
9+
* Note: This method will only be available if the Audio Sprite File type has been built into Phaser.
10+
*
11+
* The file is **not** loaded immediately after calling this method.
12+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
13+
*
14+
* @method Phaser.Loader.LoaderPlugin#audioSprite
15+
* @since 3.0.0
16+
*
17+
* @param {string} key - [description]
18+
* @param {string|string[]} urls - [description]
19+
* @param {object} json - [description]
20+
* @param {object} config - [description]
21+
* @param {object} audioXhrSettings - Optional file specific XHR settings.
22+
* @param {object} jsonXhrSettings - Optional file specific XHR settings.
23+
*
24+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
25+
*/
826
FileTypesManager.register('audioSprite', function (key, urls, json, config, audioXhrSettings, jsonXhrSettings)
927
{
1028
var audioFile = AudioFile.create(this, key, urls, config, audioXhrSettings);

src/loader/filetypes/BinaryFile.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ var File = require('../File');
44
var FileTypesManager = require('../FileTypesManager');
55
var GetFastValue = require('../../utils/object/GetFastValue');
66

7-
// Phaser.Loader.FileTypes.BinaryFile
8-
7+
/**
8+
* @classdesc
9+
* [description]
10+
*
11+
* @class BinaryFile
12+
* @extends Phaser.Loader.File
13+
* @memberOf Phaser.Loader.FileTypes
14+
* @constructor
15+
* @since 3.0.0
16+
*
17+
* @param {string} key - [description]
18+
* @param {string} url - [description]
19+
* @param {string} path - [description]
20+
* @param {object} xhrSettings - [description]
21+
*/
922
var BinaryFile = new Class({
1023

1124
Extends: File,
@@ -42,12 +55,23 @@ var BinaryFile = new Class({
4255

4356
});
4457

45-
// When registering a factory function 'this' refers to the Loader context.
46-
//
47-
// There are several properties available to use:
48-
//
49-
// this.scene - a reference to the Scene that owns the GameObjectFactory
50-
58+
/**
59+
* Adds Binary file to the current load queue.
60+
*
61+
* Note: This method will only be available if the Binary File type has been built into Phaser.
62+
*
63+
* The file is **not** loaded immediately after calling this method.
64+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
65+
*
66+
* @method Phaser.Loader.LoaderPlugin#binary
67+
* @since 3.0.0
68+
*
69+
* @param {string} key - [description]
70+
* @param {string} url - [description]
71+
* @param {object} xhrSettings - [description]
72+
*
73+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
74+
*/
5175
FileTypesManager.register('binary', function (key, url, xhrSettings)
5276
{
5377
if (Array.isArray(key))

src/loader/filetypes/BitmapFontFile.js

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@ var FileTypesManager = require('../FileTypesManager');
22
var ImageFile = require('./ImageFile.js');
33
var XMLFile = require('./XMLFile.js');
44

5+
/**
6+
* An Bitmap Font File.
7+
*
8+
* @function Phaser.Loader.Filetypes.BitmapFontFile
9+
* @since 3.0.0
10+
*
11+
* @param {string} key - The key of the file within the loader.
12+
* @param {string} textureURL - The url to load the texture file from.
13+
* @param {string} xmlURL - The url to load the atlas file from.
14+
* @param {string} path - The path of the file.
15+
* @param {object} textureXhrSettings - Optional texture file specific XHR settings.
16+
* @param {object} xmlXhrSettings - Optional atlas file specific XHR settings.
17+
*
18+
* @return {object} An object containing two File objects to be added to the loader.
19+
*/
520
var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings, xmlXhrSettings)
621
{
722
var image = new ImageFile(key, textureURL, path, textureXhrSettings);
@@ -18,12 +33,25 @@ var BitmapFontFile = function (key, textureURL, xmlURL, path, textureXhrSettings
1833
return { texture: image, data: data };
1934
};
2035

21-
// When registering a factory function 'this' refers to the Loader context.
22-
//
23-
// There are several properties available to use:
24-
//
25-
// this.scene - a reference to the Scene that owns the GameObjectFactory
26-
36+
/**
37+
* Adds a Bitmap Font file to the current load queue.
38+
*
39+
* Note: This method will only be available if the Bitmap Font File type has been built into Phaser.
40+
*
41+
* The file is **not** loaded immediately after calling this method.
42+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
43+
*
44+
* @method Phaser.Loader.LoaderPlugin#bitmapFont
45+
* @since 3.0.0
46+
*
47+
* @param {string} key - [description]
48+
* @param {string} textureURL - [description]
49+
* @param {string} xmlURL - [description]
50+
* @param {object} textureXhrSettings - [description]
51+
* @param {object} xmlXhrSettings - [description]
52+
*
53+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
54+
*/
2755
FileTypesManager.register('bitmapFont', function (key, textureURL, xmlURL, textureXhrSettings, xmlXhrSettings)
2856
{
2957
// Returns an object with two properties: 'texture' and 'data'

src/loader/filetypes/GLSLFile.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ var File = require('../File');
44
var FileTypesManager = require('../FileTypesManager');
55
var GetFastValue = require('../../utils/object/GetFastValue');
66

7-
// Phaser.Loader.FileTypes.GLSLFile
8-
7+
/**
8+
* @classdesc
9+
* [description]
10+
*
11+
* @class GLSLFile
12+
* @extends Phaser.Loader.File
13+
* @memberOf Phaser.Loader.FileTypes
14+
* @constructor
15+
* @since 3.0.0
16+
*
17+
* @param {string} key - [description]
18+
* @param {string} url - [description]
19+
* @param {string} path - [description]
20+
* @param {object} xhrSettings - [description]
21+
*/
922
var GLSLFile = new Class({
1023

1124
Extends: File,
@@ -42,12 +55,23 @@ var GLSLFile = new Class({
4255

4356
});
4457

45-
// When registering a factory function 'this' refers to the Loader context.
46-
//
47-
// There are several properties available to use:
48-
//
49-
// this.scene - a reference to the Scene that owns the GameObjectFactory
50-
58+
/**
59+
* Adds a GLSL file to the current load queue.
60+
*
61+
* Note: This method will only be available if the GLSL File type has been built into Phaser.
62+
*
63+
* The file is **not** loaded immediately after calling this method.
64+
* Instead, the file is added to a queue within the Loader, which is processed automatically when the Loader starts.
65+
*
66+
* @method Phaser.Loader.LoaderPlugin#glsl
67+
* @since 3.0.0
68+
*
69+
* @param {string} key - [description]
70+
* @param {string} url - [description]
71+
* @param {object} xhrSettings - [description]
72+
*
73+
* @return {Phaser.Loader.LoaderPlugin} The Loader.
74+
*/
5175
FileTypesManager.register('glsl', function (key, url, xhrSettings)
5276
{
5377
if (Array.isArray(key))

src/loader/filetypes/HTML5AudioFile.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,22 @@ var File = require('../File');
33
var GetFastValue = require('../../utils/object/GetFastValue');
44
var GetURL = require('../GetURL');
55

6-
// Phaser.Loader.FileTypes.HTML5AudioFile
7-
6+
/**
7+
* @classdesc
8+
* [description]
9+
*
10+
* @class HTML5AudioFile
11+
* @extends Phaser.Loader.File
12+
* @memberOf Phaser.Loader.FileTypes
13+
* @constructor
14+
* @since 3.0.0
15+
*
16+
* @param {string} key - [description]
17+
* @param {string} url - [description]
18+
* @param {string} path - [description]
19+
* @param {object} config - [description]
20+
* @param {boolean} locked - [description]
21+
*/
822
var HTML5AudioFile = new Class({
923

1024
Extends: File,

0 commit comments

Comments
 (0)