Skip to content

Commit 7b66a78

Browse files
committed
Enhanced the intro/outro usage. The Pixidefaults inclusion have been decoupled from the Phaser Outro and put into a separate module, prior to this it would not be possible to exclude the UMD wrapper and keep the pixi defaults, which I'm not sure would have been much use to anyone, now you can optionaly keep the pixi defaults.
Also the Pixi intro module has been split into intro/main modules, so it's intro/outro modules can be excluded cleanly without being tied to the body of the Pixi code. Finally the Pixi into/outro exclusion is tied to Phaser's excludes, ie if Phasers intro/outro is excluded so are Pixi's - this could be separated by giving pixi it's own module list but I can't see why anyone would not want to exclude the wrappers from both, they can always generate the Phaser/Pixi modules in separate passes if they want differing wrapping anyway.
1 parent 1c169ef commit 7b66a78

6 files changed

Lines changed: 81 additions & 49 deletions

File tree

Gruntfile.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <binding />
1+
/// <binding BeforeBuild='default' />
22
module.exports = function (grunt) {
33

44
var loadConfig = require('load-grunt-config');
@@ -32,7 +32,6 @@ module.exports = function (grunt) {
3232
grunt.registerTask('custom', 'Build a custom version of Phaser', function(arg) {
3333

3434
var modules = {
35-
3635
'intro': { 'description': 'Phaser UMD wrapper', 'optional': true, 'stub': false },
3736
'phaser': { 'description': 'Phaser Globals', 'optional': false, 'stub': false },
3837
'geom': { 'description': 'Geometry Classes', 'optional': false, 'stub': false },
@@ -73,8 +72,8 @@ module.exports = function (grunt) {
7372
'particles': { 'description': 'Arcade Physics Particle System', 'optional': true, 'stub': true },
7473
'creature': { 'description': 'Creature Animation Tool Support', 'optional': true, 'stub': false },
7574
'video': { 'description': 'Video Game Object', 'optional': true, 'stub': false },
75+
'pixidefs': { 'description': 'Pixi defaults', 'optional': true, 'stub': false },
7676
'outro': { 'description': 'Phaser UMD closure', 'optional': true, 'stub': false }
77-
7877
};
7978

8079
grunt.log.writeln("---------------------");
@@ -220,9 +219,16 @@ module.exports = function (grunt) {
220219
// 3) PIXI
221220

222221
grunt.log.writeln("-> PIXI");
223-
tasks.push('concat:pixiIntro');
224-
pixiFilelist.push('<%= modules_dir %>/pixi-intro.js');
222+
223+
if (!excludedKeys['intro'])
224+
{
225+
tasks.push('concat:pixiIntro');
226+
pixiFilelist.push('<%= modules_dir %>/pixi-intro.js');
227+
}
225228

229+
tasks.push('concat:pixiMain');
230+
pixiFilelist.push('<%= modules_dir %>/pixi-main.js');
231+
226232
// Optional Rope
227233
if (!excludedKeys['rope'])
228234
{
@@ -240,8 +246,11 @@ module.exports = function (grunt) {
240246
}
241247

242248
// PIXI Outro
243-
tasks.push('concat:pixiOutro');
244-
pixiFilelist.push('<%= modules_dir %>/pixi-outro.js');
249+
if (!excludedKeys['outro'])
250+
{
251+
tasks.push('concat:pixiOutro');
252+
pixiFilelist.push('<%= modules_dir %>/pixi-outro.js');
253+
}
245254

246255
grunt.config.set('pixiFilelist', pixiFilelist);
247256

@@ -283,9 +292,16 @@ module.exports = function (grunt) {
283292
// 3) PIXI
284293

285294
grunt.log.writeln("-> PIXI");
286-
tasks.push('concat:pixiIntro');
287-
filelist.push('<%= modules_dir %>/pixi-intro.js');
295+
296+
if (!excludedKeys['intro'])
297+
{
298+
tasks.push('concat:pixiIntro');
299+
filelist.push('<%= modules_dir %>/pixi-intro.js');
300+
}
288301

302+
tasks.push('concat:pixiMain');
303+
filelist.push('<%= modules_dir %>/pixi-main.js');
304+
289305
// Optional Rope
290306
if (!excludedKeys['rope'])
291307
{
@@ -303,8 +319,11 @@ module.exports = function (grunt) {
303319
}
304320

305321
// PIXI Outro
306-
tasks.push('concat:pixiOutro');
307-
filelist.push('<%= modules_dir %>/pixi-outro.js');
322+
if (!excludedKeys['outro'])
323+
{
324+
tasks.push('concat:pixiOutro');
325+
filelist.push('<%= modules_dir %>/pixi-outro.js');
326+
}
308327
}
309328

310329
// And now for Phaser

tasks/manifests/outro.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[
2-
"src/PixiDefaults.js",
32
"src/Outro.js"
43
]

tasks/manifests/pixi-intro.json

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,3 @@
11
[
2-
"src/pixi/Intro.js",
3-
4-
"src/pixi/Pixi.js",
5-
"src/pixi/display/DisplayObject.js",
6-
"src/pixi/display/DisplayObjectContainer.js",
7-
"src/pixi/display/Sprite.js",
8-
"src/pixi/display/SpriteBatch.js",
9-
10-
"src/pixi/utils/Utils.js",
11-
"src/pixi/utils/CanvasPool.js",
12-
13-
"src/pixi/renderers/webgl/utils/WebGLShaderUtils.js",
14-
"src/pixi/renderers/webgl/shaders/PixiShader.js",
15-
"src/pixi/renderers/webgl/shaders/PixiFastShader.js",
16-
"src/pixi/renderers/webgl/shaders/StripShader.js",
17-
"src/pixi/renderers/webgl/shaders/PrimitiveShader.js",
18-
"src/pixi/renderers/webgl/shaders/ComplexPrimitiveShader.js",
19-
"src/pixi/renderers/webgl/WebGLRenderer.js",
20-
"src/pixi/renderers/webgl/utils/WebGLBlendModeManager.js",
21-
"src/pixi/renderers/webgl/utils/WebGLMaskManager.js",
22-
"src/pixi/renderers/webgl/utils/WebGLStencilManager.js",
23-
"src/pixi/renderers/webgl/utils/WebGLShaderManager.js",
24-
"src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js",
25-
"src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js",
26-
"src/pixi/renderers/webgl/utils/WebGLFilterManager.js",
27-
"src/pixi/renderers/webgl/utils/FilterTexture.js",
28-
"src/pixi/renderers/canvas/utils/CanvasBuffer.js",
29-
"src/pixi/renderers/canvas/utils/CanvasMaskManager.js",
30-
"src/pixi/renderers/canvas/utils/CanvasTinter.js",
31-
"src/pixi/renderers/canvas/CanvasRenderer.js",
32-
33-
"src/pixi/textures/BaseTexture.js",
34-
"src/pixi/textures/Texture.js",
35-
"src/pixi/textures/RenderTexture.js",
36-
37-
"src/pixi/filters/AbstractFilter.js"
38-
2+
"src/pixi/Intro.js"
393
]

tasks/manifests/pixi-main.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
"src/pixi/Pixi.js",
3+
"src/pixi/display/DisplayObject.js",
4+
"src/pixi/display/DisplayObjectContainer.js",
5+
"src/pixi/display/Sprite.js",
6+
"src/pixi/display/SpriteBatch.js",
7+
8+
"src/pixi/utils/Utils.js",
9+
"src/pixi/utils/CanvasPool.js",
10+
11+
"src/pixi/renderers/webgl/utils/WebGLShaderUtils.js",
12+
"src/pixi/renderers/webgl/shaders/PixiShader.js",
13+
"src/pixi/renderers/webgl/shaders/PixiFastShader.js",
14+
"src/pixi/renderers/webgl/shaders/StripShader.js",
15+
"src/pixi/renderers/webgl/shaders/PrimitiveShader.js",
16+
"src/pixi/renderers/webgl/shaders/ComplexPrimitiveShader.js",
17+
"src/pixi/renderers/webgl/WebGLRenderer.js",
18+
"src/pixi/renderers/webgl/utils/WebGLBlendModeManager.js",
19+
"src/pixi/renderers/webgl/utils/WebGLMaskManager.js",
20+
"src/pixi/renderers/webgl/utils/WebGLStencilManager.js",
21+
"src/pixi/renderers/webgl/utils/WebGLShaderManager.js",
22+
"src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js",
23+
"src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js",
24+
"src/pixi/renderers/webgl/utils/WebGLFilterManager.js",
25+
"src/pixi/renderers/webgl/utils/FilterTexture.js",
26+
"src/pixi/renderers/canvas/utils/CanvasBuffer.js",
27+
"src/pixi/renderers/canvas/utils/CanvasMaskManager.js",
28+
"src/pixi/renderers/canvas/utils/CanvasTinter.js",
29+
"src/pixi/renderers/canvas/CanvasRenderer.js",
30+
31+
"src/pixi/textures/BaseTexture.js",
32+
"src/pixi/textures/Texture.js",
33+
"src/pixi/textures/RenderTexture.js",
34+
35+
"src/pixi/filters/AbstractFilter.js"
36+
37+
]

tasks/manifests/pixidefs.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"src/PixiDefaults.js"
3+
]

tasks/options/concat.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ module.exports = {
3030
dest: '<%= modules_dir %>/pixi-intro.js'
3131
},
3232

33+
pixiMain: {
34+
src: require('../manifests/pixi-main'),
35+
dest: '<%= modules_dir %>/pixi-main.js'
36+
},
37+
3338
pixiRope: {
3439
src: require('../manifests/pixi-rope'),
3540
dest: '<%= modules_dir %>/pixi-rope.js'
@@ -295,6 +300,11 @@ module.exports = {
295300
dest: '<%= modules_dir %>/flexgrid.js'
296301
},
297302

303+
pixidefs: {
304+
src: require('../manifests/pixidefs'),
305+
dest: '<%= modules_dir %>/pixidefs.js'
306+
},
307+
298308
outro: {
299309
src: require('../manifests/outro'),
300310
dest: '<%= modules_dir %>/outro.js'

0 commit comments

Comments
 (0)