* 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)
This commit is contained in:
Richard Davey
2013-10-01 02:19:08 +01:00
parent 8668b82ef6
commit 480d90b009
6 changed files with 375 additions and 56 deletions
+38 -13
View File
@@ -1,15 +1,14 @@
<a href="http://yui.2clics.net/">Minify it</a><br />
<textarea style="width: 800px; height: 800px">
<?php
date_default_timezone_set('Europe/London');
// Get the version number
// VERSION: '1.0.5',
$vf = file_get_contents('../src/Phaser.js');
$vf = file_get_contents(dirname(__FILE__) . '/../src/Phaser.js');
$version = substr($vf, strpos($vf, 'VERSION: ') + 10, 5);
$buildLog = "Building version $version \n\n";
$header = "";
echo "Building version $version \n\n";
$js = file('../examples/js.php');
$js = file(dirname(__FILE__) . '/../examples/js.php');
$output = "";
for ($i = 0; $i < count($js); $i++)
@@ -20,10 +19,10 @@
if (strpos($line, '<script') !== false)
{
$line = str_replace('<script src="', '', $line);
$line = str_replace('"></script>', '', $line);
$line = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('"></script>', '', $line);
$filename = substr($line, strrpos($line, '/') + 1);
echo $line . "\n";
$buildLog .= $line . "\n";
// echo $filename . "\n";
// Read the file in
@@ -36,15 +35,41 @@
// {version}
$source = str_replace('{version}', $version, $source);
}
$output .= $source . "\n";
// Set the header
$header = $source;
} else {
$output .= $source . "\n";
}
}
}
//echo $output;
// Create a UMD wrapper, to allow Phaser to be exposed to AMD, Node and Browsers
$template = <<<EOT
%s(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.Phaser = factory();
}
}(this, function (b) {
%s
return Phaser;
}));
EOT;
file_put_contents('phaser.js', $output);
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'phaser.js', sprintf($template, $header, $output));
if(php_sapi_name() == 'cli' || empty($_SERVER['REMOTE_ADDR'])) {
echo "\ndone\n\n";
return;
}
?>
<a href="http://yui.2clics.net/">Minify it</a><br />
<textarea style="width: 800px; height: 800px">
<?php echo $buildLog; ?>
</textarea>