Skip to content

Commit 480d90b

Browse files
committed
* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child. * Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
1 parent 8668b82 commit 480d90b

6 files changed

Lines changed: 375 additions & 56 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ Version 1.0.7 (in progress in the dev branch)
6767
* Loaded.setPreloadSprite now rounds the width/height values and starts from 1. This fixes canvas draw errors in IE9/10 and Firefox.
6868
* Fixed issue causing Keyboard.justPressed to always fire (thanks stemkoski)
6969
* Added Keyboard.addKey() which creates a new Phaser.Key object that can be polled for updates, pressed states, etc. See the 2 new examples showing use.
70-
70+
* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
71+
* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child.
72+
* Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
7173

7274

7375

build/build.php

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
<a href="http://yui.2clics.net/">Minify it</a><br />
2-
3-
<textarea style="width: 800px; height: 800px">
41
<?php
2+
date_default_timezone_set('Europe/London');
3+
54
// Get the version number
65
// VERSION: '1.0.5',
7-
$vf = file_get_contents('../src/Phaser.js');
6+
$vf = file_get_contents(dirname(__FILE__) . '/../src/Phaser.js');
87
$version = substr($vf, strpos($vf, 'VERSION: ') + 10, 5);
8+
$buildLog = "Building version $version \n\n";
9+
$header = "";
910

10-
echo "Building version $version \n\n";
11-
12-
$js = file('../examples/js.php');
11+
$js = file(dirname(__FILE__) . '/../examples/js.php');
1312
$output = "";
1413

1514
for ($i = 0; $i < count($js); $i++)
@@ -20,10 +19,10 @@
2019
if (strpos($line, '<script') !== false)
2120
{
2221
$line = str_replace('<script src="', '', $line);
23-
$line = str_replace('"></script>', '', $line);
22+
$line = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('"></script>', '', $line);
2423
$filename = substr($line, strrpos($line, '/') + 1);
2524

26-
echo $line . "\n";
25+
$buildLog .= $line . "\n";
2726
// echo $filename . "\n";
2827

2928
// Read the file in
@@ -36,15 +35,41 @@
3635

3736
// {version}
3837
$source = str_replace('{version}', $version, $source);
39-
}
4038

41-
$output .= $source . "\n";
39+
// Set the header
40+
$header = $source;
41+
42+
} else {
43+
$output .= $source . "\n";
44+
}
4245
}
4346
}
4447

45-
//echo $output;
48+
// Create a UMD wrapper, to allow Phaser to be exposed to AMD, Node and Browsers
49+
$template = <<<EOT
50+
%s(function (root, factory) {
51+
if (typeof define === 'function' && define.amd) {
52+
define(factory);
53+
} else if (typeof exports === 'object') {
54+
module.exports = factory();
55+
} else {
56+
root.Phaser = factory();
57+
}
58+
}(this, function (b) {
59+
%s
60+
return Phaser;
61+
}));
62+
EOT;
4663

47-
file_put_contents('phaser.js', $output);
64+
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phaser.js', sprintf($template, $header, $output));
4865

66+
if(php_sapi_name() == 'cli' || empty($_SERVER['REMOTE_ADDR'])) {
67+
echo "\ndone\n\n";
68+
return;
69+
}
4970
?>
71+
<a href="http://yui.2clics.net/">Minify it</a><br />
72+
73+
<textarea style="width: 800px; height: 800px">
74+
<?php echo $buildLog; ?>
5075
</textarea>

0 commit comments

Comments
 (0)