Skip to content

Commit 0198a71

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 87fa583 + a8c0ee8 commit 0198a71

34 files changed

Lines changed: 1172 additions & 786 deletions

.npmignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
**/.*
2-
dist/
3-
docs/
4-
merge/
5-
examples/
6-
v3/
2+
wip/

src/CoreScenePlugins.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ var CoreScenePlugins = [
1111
'GameObjectCreator',
1212
'GameObjectFactory',
1313
'ScenePlugin',
14-
'DisplayList',
15-
'UpdateList'
14+
'DisplayListPlugin',
15+
'UpdateListPlugin'
1616

1717
];
1818

src/boot/Config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,18 @@ var Config = new Class({
182182
this.physics = GetValue(config, 'physics', {});
183183
this.defaultPhysicsSystem = GetValue(this.physics, 'default', false);
184184

185+
// Loader Defaults
186+
this.loaderBaseURL = GetValue(config, 'loader.baseURL', '');
187+
this.loaderPath = GetValue(config, 'loader.path', '');
188+
this.loaderEnableParallel = GetValue(config, 'loader.enableParallel', true);
189+
this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 4);
190+
this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined);
191+
this.loaderResponseType = GetValue(config, 'loader.responseType', '');
192+
this.loaderAsync = GetValue(config, 'loader.async', true);
193+
this.loaderUser = GetValue(config, 'loader.user', '');
194+
this.loaderPassword = GetValue(config, 'loader.password', '');
195+
this.loaderTimeout = GetValue(config, 'loader.timeout', 0);
196+
185197
// Scene Plugins
186198
this.defaultPlugins = GetValue(config, 'plugins', DefaultScenePlugins);
187199

src/boot/DebugHeader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ var DebugHeader = function (game)
105105
}
106106

107107
// Keep this during dev build only
108-
console.log(CHECKSUM.build);
108+
// console.log(CHECKSUM.build);
109109
};
110110

111111
module.exports = DebugHeader;

src/boot/Game.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,6 @@ var Game = new Class({
226226
*/
227227
step: function (time, delta)
228228
{
229-
var active = this.scene.active;
230-
var renderer = this.renderer;
231-
232229
// Global Managers
233230

234231
this.input.update(time, delta);
@@ -239,28 +236,21 @@ var Game = new Class({
239236

240237
this.onStepCallback();
241238

242-
for (var i = 0; i < active.length; i++)
243-
{
244-
active[i].scene.sys.step(time, delta);
245-
}
239+
this.scene.update(time, delta);
246240

247241
// Render
248242

249-
// var interpolation = this.frameDelta / this.timestep;
243+
var renderer = this.renderer;
250244

251245
renderer.preRender();
252246

253-
this.events.emit('prerender');
247+
this.events.emit('prerender', renderer);
254248

255-
// This uses active.length, in case scene.update removed the scene from the active list
256-
for (i = 0; i < active.length; i++)
257-
{
258-
active[i].scene.sys.render(0, renderer);
259-
}
249+
this.scene.render(renderer);
260250

261251
renderer.postRender();
262252

263-
this.events.emit('postrender');
253+
this.events.emit('postrender', renderer);
264254
},
265255

266256
/**

src/gameobjects/DisplayList.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
var Class = require('../utils/Class');
22
var StableSort = require('../utils/array/StableSort');
3-
var PluginManager = require('../plugins/PluginManager');
43

54
var DisplayList = new Class({
65

76
initialize:
87

9-
function DisplayList (scene)
8+
function DisplayList ()
109
{
11-
// The Scene that owns this plugin
12-
this.scene = scene;
13-
14-
this.systems = scene.sys;
15-
16-
if (!scene.sys.settings.isBooted)
17-
{
18-
scene.sys.events.once('boot', this.boot, this);
19-
}
20-
2110
// The objects that belong to this collection.
2211
// The equivalent of the old `Sprite.children` array.
2312
this.list = [];
@@ -27,14 +16,6 @@ var DisplayList = new Class({
2716
this.position = 0;
2817
},
2918

30-
boot: function ()
31-
{
32-
var eventEmitter = this.systems.events;
33-
34-
eventEmitter.on('shutdown', this.shutdown, this);
35-
eventEmitter.on('destroy', this.destroy, this);
36-
},
37-
3819
process: function ()
3920
{
4021
if (this.sortChildrenFlag)
@@ -725,6 +706,4 @@ var DisplayList = new Class({
725706

726707
});
727708

728-
PluginManager.register('DisplayList', DisplayList, 'displayList');
729-
730709
module.exports = DisplayList;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
var Class = require('../utils/Class');
2+
var DisplayList = require('./DisplayList');
3+
var PluginManager = require('../plugins/PluginManager');
4+
5+
var DisplayListPlugin = new Class({
6+
7+
Extends: DisplayList,
8+
9+
initialize:
10+
11+
function DisplayListPlugin (scene)
12+
{
13+
// The Scene that owns this plugin
14+
this.scene = scene;
15+
16+
this.systems = scene.sys;
17+
18+
if (!scene.sys.settings.isBooted)
19+
{
20+
scene.sys.events.once('boot', this.boot, this);
21+
}
22+
23+
DisplayList.call(this);
24+
},
25+
26+
boot: function ()
27+
{
28+
var eventEmitter = this.systems.events;
29+
30+
eventEmitter.on('shutdown', this.shutdown, this);
31+
eventEmitter.on('destroy', this.destroy, this);
32+
},
33+
34+
shutdown: function ()
35+
{
36+
this.removeAll();
37+
},
38+
39+
destroy: function ()
40+
{
41+
this.shutdown();
42+
}
43+
44+
});
45+
46+
PluginManager.register('DisplayListPlugin', DisplayListPlugin, 'displayList');
47+
48+
module.exports = DisplayListPlugin;

src/gameobjects/UpdateList.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
var Class = require('../utils/Class');
2-
var PluginManager = require('../plugins/PluginManager');
32

43
var UpdateList = new Class({
54

65
initialize:
76

8-
function UpdateList (scene)
7+
function UpdateList ()
98
{
10-
this.scene = scene;
11-
12-
this.systems = scene.sys;
13-
14-
if (!scene.sys.settings.isBooted)
15-
{
16-
scene.sys.events.once('boot', this.boot, this);
17-
}
18-
199
this._list = [];
2010
this._pendingInsertion = [];
2111
this._pendingRemoval = [];
2212
},
2313

24-
boot: function ()
25-
{
26-
var eventEmitter = this.systems.events;
27-
28-
eventEmitter.on('preupdate', this.preUpdate, this);
29-
eventEmitter.on('update', this.update, this);
30-
eventEmitter.on('shutdown', this.shutdown, this);
31-
eventEmitter.on('destroy', this.destroy, this);
32-
},
33-
3414
add: function (child)
3515
{
3616
// Is child already in this list?
@@ -130,12 +110,8 @@ var UpdateList = new Class({
130110
destroy: function ()
131111
{
132112
this.shutdown();
133-
134-
this.scene = undefined;
135113
}
136114

137115
});
138116

139-
PluginManager.register('UpdateList', UpdateList, 'updateList');
140-
141117
module.exports = UpdateList;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var Class = require('../utils/Class');
2+
var PluginManager = require('../plugins/PluginManager');
3+
var UpdateList = require('./UpdateList');
4+
5+
var UpdateListPlugin = new Class({
6+
7+
Extends: UpdateList,
8+
9+
initialize:
10+
11+
function UpdateListPlugin (scene)
12+
{
13+
this.scene = scene;
14+
15+
this.systems = scene.sys;
16+
17+
if (!scene.sys.settings.isBooted)
18+
{
19+
scene.sys.events.once('boot', this.boot, this);
20+
}
21+
22+
UpdateList.call(this);
23+
},
24+
25+
boot: function ()
26+
{
27+
var eventEmitter = this.systems.events;
28+
29+
eventEmitter.on('preupdate', this.preUpdate, this);
30+
eventEmitter.on('update', this.update, this);
31+
eventEmitter.on('shutdown', this.shutdown, this);
32+
eventEmitter.on('destroy', this.destroy, this);
33+
},
34+
35+
destroy: function ()
36+
{
37+
this.shutdown();
38+
39+
this.scene = undefined;
40+
}
41+
42+
});
43+
44+
PluginManager.register('UpdateListPlugin', UpdateListPlugin, 'updateList');
45+
46+
module.exports = UpdateListPlugin;

src/gameobjects/blitter/Blitter.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var Bob = require('./Bob');
33
var Class = require('../../utils/Class');
44
var Components = require('../components');
55
var DisplayList = require('../DisplayList');
6+
var Frame = require('../../textures/Frame');
67
var GameObject = require('../GameObject');
78

89
/**
@@ -41,14 +42,15 @@ var Blitter = new Class({
4142
this.setTexture(texture, frame);
4243
this.setPosition(x, y);
4344

44-
this.children = new DisplayList(this);
45+
this.children = new DisplayList();
4546

4647
this.renderList = [];
4748

4849
this.dirty = false;
4950
},
5051

5152
// frame MUST be part of the Blitter texture
53+
// and can be either a Frame object or a string
5254
create: function (x, y, frame, visible, index)
5355
{
5456
if (visible === undefined) { visible = true; }
@@ -58,7 +60,7 @@ var Blitter = new Class({
5860
{
5961
frame = this.frame;
6062
}
61-
else
63+
else if (!(frame instanceof Frame))
6264
{
6365
frame = this.texture.get(frame);
6466
}
@@ -90,7 +92,7 @@ var Blitter = new Class({
9092
// frame MUST be part of the Blitter texture
9193
createMultiple: function (quantity, frame, visible)
9294
{
93-
if (frame === undefined) { frame = this.frame; }
95+
if (frame === undefined) { frame = this.frame.name; }
9496
if (visible === undefined) { visible = true; }
9597

9698
if (!Array.isArray(frame))

0 commit comments

Comments
 (0)