New Examples area finished, README updated. Getting closer to 1.1 release.

This commit is contained in:
photonstorm
2013-10-23 04:15:44 +01:00
parent cab3b53cf0
commit f1f42e4d41
16 changed files with 351 additions and 662 deletions
+97 -1
View File
@@ -1,9 +1,105 @@
<?php
require('funcs.php');
// Global
// $files = dirToArray(dirname(__FILE__));
$files = dirToArray('../');
$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', 'states', 'wip', 'games', 'basics');
$result = array();
$root = scandir($dir);
$dirs = array_diff($root, $ignore);
// We want these 2 to appear top of the list
array_unshift($dirs, 'basics', 'games');
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, $target) {
$output = "";
foreach ($files as $key => $value)
{
$value2 = substr($value, 0, -3);
$dir = urlencode($dir);
$file = urlencode($value);
$title = urlencode($value2);
if ($target == 'viewer')
{
$output .= " <a href=\"view_lite.php?d=$dir&amp;f=$file&amp;t=$title\" target=\"viewer\">$value2</a></br>\n";
}
else if ($target == 'json')
{
$output .= " { \"file\": \"$file\", \"title\": \"$value2\" },\n";
}
else
{
$output .= " <li><a href=\"view_full.php?d=$dir&amp;f=$file&amp;t=$title\">$value2</a></li>\n";
}
}
if ($target == 'json')
{
$output = rtrim($output);
$output = substr($output, 0, -1);
$output .= "\n";
}
return $output;
}
?>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>Phaser Examples JSON Build Script</title>
</head>
<body>
+22 -1
View File
@@ -34,10 +34,31 @@ ul.nav-links > li > a:hover{text-decoration: underline;}
.phaser-examples{background: url('../../_site/images/phaser-examples.png') no-repeat; display: block; width: 485px; height: 205px; margin: 20px auto;}
.phaser-version{float: right; background: url('../../_site/images/phaser-version.png') no-repeat; display: block; width: 345px; height: 30px; color: #fff; font-size: 11px; text-shadow: 1px 1px #000; right:0; top:0; }
.phaser-version > span{margin-top: 10px; display: inline-block; margin-left: 60px; margin-right: 25px;}
.phaser-version > a{color: #fff; text-decoration: none; background: url('../../_site/images/version-button.png') no-repeat; background-size: cover; display: inline-block; width: 123px; height: 10px; vertical-align: middle; text-align: center;padding-top:11px; padding-bottom: 11px}
.phaser-version > a {color: #fff; text-decoration: none; background: url('../../_site/images/version-button.png') no-repeat; background-size: cover; display: inline-block; width: 123px; height: 10px; vertical-align: middle; text-align: center;padding-top:11px; padding-bottom: 11px}
.phaser-version > a:hover{text-decoration: underline;}
.phaser-logo{display: block; float: right; width: 168px;height: 144px; background: url('../../_site/images/phaser-logo.png') no-repeat; margin-top: 40px; margin-right: 40px;}
#upgrade {
display: none;
}
#welcome {
position: absolute;
top: 260px;
left: 40%;
width: 200px;
line-height: 28px;
}
#welcome p {
text-align: center;
text-shadow: 1px 1px 0 #fff;
}
#welcome a {
color: #7a50c4;
}
.error { margin-left: 48px; width: 700px; background-color: rgb(150,25,25); color:#fff; text-shadow: 1px 1px 0 #000; line-height: 24px }
.error p {
+11 -8
View File
@@ -1,4 +1,13 @@
{
"basics": [
{ "file": "01+-+load+an+image.js", "title": "01 - load an image" }
],
"games": [
{ "file": "breakout.js", "title": "breakout" },
{ "file": "invaders.js", "title": "invaders" },
{ "file": "starstruck.js", "title": "starstruck" },
{ "file": "tanks.js", "title": "tanks" }
],
"animation": [
{ "file": "change+texture+on+click.js", "title": "change texture on click" },
{ "file": "local+json+object.js", "title": "local json object" },
@@ -40,12 +49,6 @@
{ "file": "graphics.js", "title": "graphics" },
{ "file": "render+crisp.js", "title": "render crisp" }
],
"games": [
{ "file": "breakout.js", "title": "breakout" },
{ "file": "invaders.js", "title": "invaders" },
{ "file": "starstruck.js", "title": "starstruck" },
{ "file": "tanks.js", "title": "tanks" }
],
"geometry": [
{ "file": "circle.js", "title": "circle" },
{ "file": "line.js", "title": "line" },
@@ -131,8 +134,8 @@
{ "file": "collide+world+bounds.js", "title": "collide world bounds" },
{ "file": "destroy.js", "title": "destroy" },
{ "file": "dynamic+crop.js", "title": "dynamic crop" },
{ "file": "extending+sprite+object+demo+2.js", "title": "extending sprite object demo 2" },
{ "file": "extending+sprite+object.js", "title": "extending sprite object" },
{ "file": "extending+sprite+demo+1.js", "title": "extending sprite demo 1" },
{ "file": "extending+sprite+demo+2.js", "title": "extending sprite demo 2" },
{ "file": "horizontal+crop.js", "title": "horizontal crop" },
{ "file": "move+a+sprite.js", "title": "move a sprite" },
{ "file": "out+of+bounds.js", "title": "out of bounds" },
-119
View File
@@ -1,119 +0,0 @@
<?php
require('funcs.php');
?>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
<script src='assets/html/application.js' type='text/javascript'></script>
<link href='stylesheet.css' media='screen' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="header">
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1</span>
<!--<a href="#" class="version-button">Update to 1.2</a>-->
</div>
</div>
<div class="clear"></div>
<div class="line">
<div class="box20">
<ul class="nav-links">
<li class="link-home"><a href="http://phaser.io">Phaser Home</a></li>
<li class="link-latest"><a href="https://github.com/photonstorm/phaser">Download Latest</a></li>
<li class="link-forum"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Support Forum</a></li>
<li class="link-docs"><a href="#">Documentation</a></li>
<li class="link-twitter"><a href="https://twitter.com/photonstorm">Twitter</a></li>
</ul>
</div>
<div class="box60 txt-center">
<div class="phaser-examples"></div>
</div>
<div class="box20">
<div class="phaser-logo"></div>
</div>
</div>
</div>
<div class="clear clear25"></div>
<div class="line go-top border-bottom">
<?php
//echo "<h2>Total Tests: $total </h2>";
$i = 0;
foreach ($files as $key => $value)
{
// If $key is an array, output it as an h2 or something
if (is_array($value) && count($value) > 0)
{
if ($i == 1)
{
?>
<div class="clear5"></div>
<div class="line dark-bg">
<?php
}
else if ($i == 2)
{
?>
<div class="clear5"></div>
<div class="line bright-bg">
<?php
}
?>
<div class="box20">
<p class="title strong"><?php echo $key ?></p>
<p class="count-examples strong"><?php echo count($value) ?> examples</p>
</div>
<div class="box80">
<ul class="group-items">
<?php
echo printJSLinks($key, $value, false);
$i++;
if ($i == 3)
{
$i = 1;
}
}
?>
</ul>
</div>
</div>
<?php
}
?>
<div class="clear"></div>
<div id="footer" class="footer">
<div class="main-container centered">
<div class="prize-bg">
<a href="#" class="prize-button">View details &amp; submit</a>
</div>
<div class="line">
<div class="box20">
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
&copy; 2013 Photon Storm Ltd.<br/>
All rights reserved.
</div>
<div class="box5">
<div class="flixel-logo"></div>
</div>
<div class="box15">
Looking for a flash game framework?<br/>
<a href="http://flixel.org">Try Flixel</a>
</div>
<div class="box55 float-right">
<ul class="footer-links">
<li><a class="github-icon" href="https://github.com/photonstorm/phaser">Phaser on Github</a></li>
<li><a class="twitter-icon" href="https://twitter.com/photonstorm">@photonstorm</a></li>
<li><a class="forums-icon" href="http://www.html5gamedevs.com/forum/14-phaser/">Phaser Forums</a></li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
+23 -2
View File
@@ -5,13 +5,19 @@ $(document).ready(function(){
.done(function(data) {
var i = 0;
var t = 0;
var len = 0;
var node = '';
var laser = '';
$.each(data, function(dir, files)
{
len = files.length / 4;
len = Math.floor(files.length / 4) + 1;
if ((files.length / 4) % 1 == 0)
{
len--;
}
if (len > 9)
{
@@ -19,7 +25,7 @@ $(document).ready(function(){
}
else
{
laser = 'laser' + (len + 1);
laser = 'laser' + len;
}
if (i == 1)
@@ -38,6 +44,7 @@ $(document).ready(function(){
for (var e = 0; e < files.length; e++)
{
node += '<li><a href="_site/view_full.html?d=' + dir + '&amp;f=' + files[e].file + '&amp;t=' + files[e].title + '">' + files[e].title + '</a></li>';
t++;
}
node += '</ul></div>';
@@ -53,6 +60,8 @@ $(document).ready(function(){
});
$("#total").append(t);
})
.fail(function() {
@@ -74,4 +83,16 @@ $(document).ready(function(){
});
$.getJSON("http://phaser.io/version.json")
.done(function(data) {
if (data.version !== '1.1')
{
$("#upgrade").append(data.version);
$("#upgrade").css('display', 'inline-block');
}
});
});
-124
View File
@@ -1,124 +0,0 @@
<?php
require('funcs.php');
?>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<style>
@font-face {
font-family: 'inconsolata';
src: url('assets/html/inconsolata.woff') format('woff');
font-weight: normal;
font-style: normal;
}
body {
background: #e0e4f1;
margin: 0px;
font-family: 'inconsolata';
font-size: 15px;
overflow: hidden;
}
a {
text-decoration: none;
color: #1c99bb;
}
a:hover {
background-color: #e69b0b;
color: #fff;
}
h1 {
font-size: 25px;
font-weight: normal;
}
h2 {
font-size: 20px;
font-weight: normal;
}
#header {
background: url(assets/html/lite_header.jpg) no-repeat left top;
width: 300px;
height: 100px;
}
#panel {
background: url(assets/html/lite_header_2.jpg) no-repeat left top;
width: 300px;
height: -webkit-calc(100% - 270px); /* Safari */
height: calc(100% - 270px);
overflow-x: hidden;
overflow-y: scroll;
}
#panel #list {
padding: 10px 20px;
line-height: 18px;
}
#footer {
background: url(assets/html/lite_footer.jpg) no-repeat left top;
width: 300px;
height: 170px;
color: #000;
text-align: center;
}
#viewer {
position: absolute;
top: 0px;
left: 300px;
width: -webkit-calc(100% - 300px); /* Safari */
width: calc(100% - 300px);
height: 100%;
border: 0px;
}
</style>
</head>
<body>
<div id="header"></div>
<div id="panel">
<div id="list">
<?php
foreach ($files as $key => $value)
{
// If $key is an array, output it as an h2 or something
if (is_array($value) && count($value) > 0)
{
echo "<h2>$key</h2>";
echo printJSLinks($key, $value, 'viewer');
}
}
?>
</div>
</div>
<div id="footer">
<p>Total examples: <?php echo $total?></p>
<p>Phaser version: 1.1</p>
<p>Layout borrowed from three.js</p>
</div>
<iframe id="viewer"></iframe>
</body>
</html>
-123
View File
@@ -1,123 +0,0 @@
<?php
// All JS files in build order.
// Much easier for debugging re: line numbers
?>
<script src="../src/Intro.js"></script>
<script src="../src/pixi/Pixi.js"></script>
<script src="../src/Phaser.js"></script>
<script src="../src/utils/Utils.js"></script>
<script src="../src/pixi/core/Matrix.js"></script>
<script src="../src/pixi/core/Point.js"></script>
<script src="../src/pixi/core/Rectangle.js"></script>
<script src="../src/pixi/display/DisplayObject.js"></script>
<script src="../src/pixi/display/DisplayObjectContainer.js"></script>
<script src="../src/pixi/display/Sprite.js"></script>
<script src="../src/pixi/display/Stage.js"></script>
<script src="../src/pixi/extras/CustomRenderable.js"></script>
<script src="../src/pixi/extras/Strip.js"></script>
<script src="../src/pixi/extras/Rope.js"></script>
<script src="../src/pixi/extras/TilingSprite.js"></script>
<script src="../src/pixi/filters/FilterBlock.js"></script>
<script src="../src/pixi/filters/MaskFilter.js"></script>
<script src="../src/pixi/primitives/Graphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLBatch.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLGraphics.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderGroup.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLShaders.js"></script>
<script src="../src/pixi/text/BitmapText.js"></script>
<script src="../src/pixi/text/Text.js"></script>
<script src="../src/pixi/textures/BaseTexture.js"></script>
<script src="../src/pixi/textures/Texture.js"></script>
<script src="../src/pixi/textures/RenderTexture.js"></script>
<script src="../src/pixi/utils/EventTarget.js"></script>
<script src="../src/pixi/utils/Polyk.js"></script>
<script src="../src/core/Camera.js"></script>
<script src="../src/core/State.js"></script>
<script src="../src/core/StateManager.js"></script>
<script src="../src/core/LinkedList.js"></script>
<script src="../src/core/Signal.js"></script>
<script src="../src/core/SignalBinding.js"></script>
<script src="../src/core/Plugin.js"></script>
<script src="../src/core/PluginManager.js"></script>
<script src="../src/core/Stage.js"></script>
<script src="../src/core/Group.js"></script>
<script src="../src/core/World.js"></script>
<script src="../src/core/Game.js"></script>
<script src="../src/input/Input.js"></script>
<script src="../src/input/Key.js"></script>
<script src="../src/input/Keyboard.js"></script>
<script src="../src/input/Mouse.js"></script>
<script src="../src/input/MSPointer.js"></script>
<script src="../src/input/Pointer.js"></script>
<script src="../src/input/Touch.js"></script>
<script src="../src/input/InputHandler.js"></script>
<script src="../src/gameobjects/Events.js"></script>
<script src="../src/gameobjects/GameObjectFactory.js"></script>
<script src="../src/gameobjects/Sprite.js"></script>
<script src="../src/gameobjects/TileSprite.js"></script>
<script src="../src/gameobjects/Text.js"></script>
<script src="../src/gameobjects/BitmapText.js"></script>
<script src="../src/gameobjects/Button.js"></script>
<script src="../src/gameobjects/Graphics.js"></script>
<script src="../src/gameobjects/RenderTexture.js"></script>
<script src="../src/system/Canvas.js"></script>
<script src="../src/system/StageScaleMode.js"></script>
<script src="../src/system/Device.js"></script>
<script src="../src/system/RequestAnimationFrame.js"></script>
<script src="../src/math/RandomDataGenerator.js"></script>
<script src="../src/math/Math.js"></script>
<script src="../src/math/QuadTree.js"></script>
<script src="../src/geom/Circle.js"></script>
<script src="../src/geom/Point.js"></script>
<script src="../src/geom/Rectangle.js"></script>
<script src="../src/net/Net.js"></script>
<script src="../src/tween/TweenManager.js"></script>
<script src="../src/tween/Tween.js"></script>
<script src="../src/tween/Easing.js"></script>
<script src="../src/time/Time.js"></script>
<script src="../src/animation/AnimationManager.js"></script>
<script src="../src/animation/Animation.js"></script>
<script src="../src/animation/Frame.js"></script>
<script src="../src/animation/FrameData.js"></script>
<script src="../src/animation/AnimationParser.js"></script>
<script src="../src/loader/Cache.js"></script>
<script src="../src/loader/Loader.js"></script>
<script src="../src/loader/LoaderParser.js"></script>
<script src="../src/sound/Sound.js"></script>
<script src="../src/sound/SoundManager.js"></script>
<script src="../src/utils/Debug.js"></script>
<script src="../src/utils/Color.js"></script>
<script src="../src/physics/arcade/ArcadePhysics.js"></script>
<script src="../src/physics/arcade/Body.js"></script>
<script src="../src/particles/Particles.js"></script>
<script src="../src/particles/arcade/ArcadeParticles.js"></script>
<script src="../src/particles/arcade/Emitter.js"></script>
<script src="../src/tilemap/Tile.js"></script>
<script src="../src/tilemap/Tilemap.js"></script>
<script src="../src/tilemap/TilemapLayer.js"></script>
<script src="../src/tilemap/TilemapParser.js"></script>
<script src="../src/tilemap/Tileset.js"></script>
<script src="../src/PixiPatch.js"></script>
-103
View File
@@ -1,103 +0,0 @@
<?php
require('funcs.php');
getFile();
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser - <?php echo $title?></title>
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<script src='assets/html/application.js' type='text/javascript'></script>
<link href='stylesheet.css' media='screen' rel='stylesheet' type='text/css'>
<?php
require('phaser-debug-js.php');
?>
<script src="<?php echo $filename?>"></script>
</head>
<body>
<div class="header">
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1</span>
<!--<a href="#" class="version-button">Update to 1.2</a>-->
</div>
</div>
<div class="clear"></div>
<div class="line">
<div class="box20">
<ul class="nav-links">
<li class="link-home"><a href="index.php">Back to examples</a></li>
</ul>
</div>
<div class="box60 txt-center">
<span class="main-title"><?php echo ucwords($title)?></span>
</div>
<div class="box20">
<div class="phaser-logo"></div>
</div>
</div>
<div class="game-panel centered">
<div id="phaser-example"></div>
<div class="game-controls">
<ul class="left-controls">
<li class="controls-label"></li>
<li class="up-label"></li>
<li class="down-label"></li>
<li class="left-label"></li>
<li class="right-label"></li>
<li class="space-label"></li>
</ul>
<ul class="right-controls">
<li class="pause-button"></li>
<li class="mute-button"></li>
<li class="reset-button"></li>
</ul>
</div>
</div>
</div>
<div class="clear filler"></div>
<p class="centered px800">Source code:</p>
<pre class="code-block prettyprint centered">
<?php
echo $code;
?>
</pre>
</div>
<div class="clear"></div>
<div id="footer" class="footer">
<div class="main-container centered">
<div class="prize-bg">
<a href="#" class="prize-button">View details &amp; submit</a>
</div>
<div class="line">
<div class="box20">
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
&copy; 2013 Photon Storm Ltd.<br/>
All rights reserved.
</div>
<div class="box5">
<div class="flixel-logo"></div>
</div>
<div class="box15">
Looking for a flash game framework?<br/>
<a href="http://flixel.org">Try Flixel</a>
</div>
<div class="box55 float-right">
<ul class="footer-links">
<li><a class="github-icon" href="https://github.com/photonstorm/phaser">Phaser on Github</a></li>
<li><a class="twitter-icon" href="https://twitter.com/photonstorm">@photonstorm</a></li>
<li><a class="forums-icon" href="http://www.html5gamedevs.com/forum/14-phaser/">Phaser Forums</a></li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
-28
View File
@@ -1,28 +0,0 @@
<?php
require('funcs.php');
getFile();
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser - <?php echo $title?></title>
<?php
require('phaser-debug-js.php');
?>
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<script src="<?php echo $filename?>"></script>
</head>
<body>
<div id="phaser-example"></div>
<pre class="prettyprint">
<?php
echo $code;
?>
</pre>
</body>
</html>
-27
View File
@@ -1,27 +0,0 @@
<?php
require('funcs.php');
getFile();
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title><?php echo $title?></title>
<?php
require('phaser-debug-js.php');
?>
<script src="<?php echo $filename?>"></script>
<style>
body {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>
+22
View File
@@ -0,0 +1,22 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create });
function preload() {
// You can fill the preloader with as many assets as your game requires
// Here we are loading an image. The first parameter is the unique
// string by which we'll identify the image later in our code.
// The second parameter is the URL of the image (relative)
game.load.image('einstein', 'assets/pics/ra_einstein.png');
}
function create() {
// This creates a simple sprite that is using our loaded image and
// displays it on-screen
game.add.sprite(0, 0, 'einstein');
}
+10 -3
View File
@@ -2,6 +2,7 @@
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Phaser Examples</title>
<link href="_site/css/phaser-examples.css" media="screen" rel="stylesheet" type="text/css">
<script src="_site/js/jquery-2.0.3.min.js" type="text/javascript"></script>
<script src="_site/js/phaser-examples.js" type="text/javascript"></script>
@@ -12,7 +13,7 @@
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1</span>
<a href="https://github.com/photonstorm/phaser/tree/dev" class="version-button">1.2 dev branch</a>
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
</div>
</div>
@@ -23,7 +24,7 @@
<li class="link-home"><a href="http://phaser.io">Phaser Home</a></li>
<li class="link-latest"><a href="https://github.com/photonstorm/phaser">Download Latest</a></li>
<li class="link-forum"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Support Forum</a></li>
<li class="link-docs"><a href="#">Documentation</a></li>
<li class="link-docs"><a href="../docs/out/">Documentation</a></li>
<li class="link-twitter"><a href="https://twitter.com/photonstorm">Twitter</a></li>
</ul>
</div>
@@ -37,7 +38,13 @@
</div>
<div class="clear clear25"></div>
<p>Some stuff here</p>
<div id="welcome">
<p>Total Examples: <span id="total"></span></p>
<p><a href="sideview.html">Switch to Side-View mode</a></p>
</div>
<div id="examples-list" class="line go-top border-bottom"></div>
+29
View File
@@ -0,0 +1,29 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
function preload() {
game.load.image('ball', 'assets/sprites/yellow_ball.png');
}
var ball;
function create() {
ball = game.add.sprite(300, 0, 'ball');
startBounceTween();
}
function startBounceTween() {
ball.y = 0;
var bounce=game.add.tween(ball);
bounce.to({ y: game.world.height-ball.height }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.In);
bounce.onComplete.add(startBounceTween, this);
bounce.start();
}
@@ -55,40 +55,55 @@
return $result;
}
function printJSLinks($dir, $files, $target) {
function printJSLinks($dir, $files) {
$output = "";
foreach ($files as $key => $value)
{
$value2 = substr($value, 0, -3);
$dir = urlencode($dir);
$file = urlencode($value);
$title = urlencode($value2);
if ($target == 'viewer')
{
$output .= " <a href=\"view_lite.php?d=$dir&amp;f=$file&amp;t=$title\" target=\"viewer\">$value2</a></br>\n";
}
else if ($target == 'json')
{
$output .= " { \"file\": \"$file\", \"title\": \"$value2\" },\n";
}
else
{
$output .= " <li><a href=\"view_full.php?d=$dir&amp;f=$file&amp;t=$title\">$value2</a></li>\n";
}
}
if ($target == 'json')
{
$output = rtrim($output);
$output = substr($output, 0, -1);
$output .= "\n";
$output .= "<a href=\"wip/index.php?f=$file\">$value2</a><br />";
}
return $output;
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<base href="../"></base>
<?php
require('../../build/config.php');
?>
if (isset($_GET['f']))
{
$f = $_GET['f'];
?>
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
<?php
}
?>
<style>
body {
font-family: Arial;
font-size: 14px;
}
</style>
</head>
<body>
<div id="phaser-example"></div>
<h2>work in progress examples</h2>
<?php
echo printJSLinks('wip', $files);
?>
</body>
</html>