mirror of
https://github.com/wassname/phaser.git
synced 2026-07-28 11:23:50 +08:00
The grunt task now creates an optional version of Phaser without any Physics support built in. Quite a bit smaller now.
The grunt task now has a new `noUmd` option which builds Phaser without the UMD wrapper.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }, true);
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
@@ -15,7 +15,7 @@ var music;
|
||||
|
||||
function create() {
|
||||
|
||||
// game.stage.backgroundColor = '#182d3b';
|
||||
game.stage.backgroundColor = '#182d3b';
|
||||
game.input.touch.preventDefault = false;
|
||||
|
||||
music = game.add.audio('boden');
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
// Global
|
||||
$files = dirToArray(dirname(__FILE__));
|
||||
$total = 0;
|
||||
|
||||
foreach ($files as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) > 0)
|
||||
{
|
||||
$total += count($value);
|
||||
}
|
||||
}
|
||||
|
||||
function getFile() {
|
||||
|
||||
global $files, $dir, $filename, $title, $code;
|
||||
|
||||
if (isset($_GET['d']) && isset($_GET['f']))
|
||||
{
|
||||
$dir = urldecode($_GET['d']);
|
||||
$filename = urldecode($_GET['d']) . '/' . urldecode($_GET['f']);
|
||||
$title = urldecode($_GET['t']);
|
||||
|
||||
if (file_exists($filename))
|
||||
{
|
||||
$code = file_get_contents($filename);
|
||||
$files = dirToArray($dir);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function dirToArray($dir) {
|
||||
|
||||
$ignore = array('.', '..', '_site', 'assets', 'gfx', 'states', 'book', 'filters', 'misc');
|
||||
$result = array();
|
||||
$root = scandir($dir);
|
||||
$dirs = array_diff($root, $ignore);
|
||||
|
||||
foreach ($dirs as $key => $value)
|
||||
{
|
||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
|
||||
{
|
||||
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($value, -3) == '.js')
|
||||
{
|
||||
$result[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function printJSLinks($dir, $files) {
|
||||
|
||||
$output = "";
|
||||
|
||||
foreach ($files as $key => $value)
|
||||
{
|
||||
$value2 = substr($value, 0, -3);
|
||||
$file = urlencode($value);
|
||||
|
||||
$output .= "<a href=\"wip/indexNoPhysics.php?f=$file\">$value2</a><br />";
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="initial-scale=1 maximum-scale=1 user-scalable=0 minimal-ui" />
|
||||
<title>phaser / no-physics</title>
|
||||
<base href="../" />
|
||||
<script src="_site/js/jquery-2.0.3.min.js" type="text/javascript"></script>
|
||||
<script src="../build/phaserNoPhysics.js" type="text/javascript"></script>
|
||||
<?php
|
||||
if (isset($_GET['f']))
|
||||
{
|
||||
$f = $_GET['f'];
|
||||
?>
|
||||
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="phaser-example"></div>
|
||||
|
||||
<div style="padding: 32px">
|
||||
|
||||
<h2>work in progress examples</h2>
|
||||
|
||||
<?php
|
||||
echo printJSLinks('wip', $files);
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('pic', 'assets/pics/backscroll.png');
|
||||
|
||||
}
|
||||
|
||||
var text;
|
||||
var b;
|
||||
var grd;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.setBackgroundColor(0x2d2d2d);
|
||||
|
||||
text = game.add.text(game.world.centerX, game.world.centerY, "- phaser -\nwith a sprinkle of\npixi dust");
|
||||
text.anchor.set(0.5);
|
||||
|
||||
text.font = 'Art of Fighting 2';
|
||||
// text.font = 'Arial Black';
|
||||
text.fontSize = 20;
|
||||
text.fontWeight = 'bold';
|
||||
|
||||
// x0, y0 - x1, y1
|
||||
grd = text.context.createLinearGradient(0, 0, 0, text.canvas.height);
|
||||
grd.addColorStop(0, '#8ED6FF');
|
||||
grd.addColorStop(1, '#004CB3');
|
||||
text.fill = grd;
|
||||
|
||||
// text.fill = '#ff0044';
|
||||
// text.lineSpacing = 16;
|
||||
text.align = 'center';
|
||||
text.stroke = '#000000';
|
||||
text.strokeThickness = 2;
|
||||
|
||||
// text.setShadow(5, 5, 'rgba(0,0,0,0.5)', 5);
|
||||
|
||||
// text.scale.set(4);
|
||||
|
||||
// game.add.tween(text).to({fontSize: 60}, 1000, Phaser.Easing.Linear.None,true);
|
||||
game.add.tween(text.scale).to({x: 6, y: 6}, 2000, Phaser.Easing.Linear.None,true);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user