Skip to content

Commit 8ed7838

Browse files
committed
New examples page
1 parent dabda51 commit 8ed7838

11 files changed

Lines changed: 209 additions & 65 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ Version 1.0.7 (in progress in the dev branch)
126126
* Added Text.destroy() and BitmapText.destroy(), also updated Group.remove to make it more bullet-proof when an element doesn't have any events.
127127
* Added Phaser.Utils.shuffle to shuffle an array.
128128
* Added Graphics.destroy, x, y and updated angle functions.
129+
* Additional checks added to AnimationManager.frame/frameName on the given values.
130+
* Added AnimationManager.refreshFrame - will reset the texture being used for a Sprite (useful after a crop rect clear)
131+
* You can now null a Sprite.crop and it will clear down the crop rect area correctly.
132+
* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils.
133+
129134

130135

131136

build/phaser.js

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Phaser - http://www.phaser.io
1111
*
12-
* v1.0.7 - Built at: Thu, 17 Oct 2013 22:56:02 +0100
12+
* v1.0.7 - Built at: Fri, 18 Oct 2013 01:36:29 +0100
1313
*
1414
* By Richard Davey http://www.photonstorm.com @photonstorm
1515
*
@@ -10948,8 +10948,9 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
1094810948
renderer = renderer || Phaser.AUTO;
1094910949
parent = parent || '';
1095010950
state = state || null;
10951+
1095110952
if (typeof transparent == 'undefined') { transparent = false; }
10952-
if (typeof antialias == 'undefined') { antialias = false; }
10953+
if (typeof antialias == 'undefined') { antialias = true; }
1095310954

1095410955
/**
1095510956
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
@@ -16644,7 +16645,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "crop", {
1664416645
this._cropRect = value;
1664516646
this.setTexture(PIXI.TextureCache[this._cropUUID]);
1664616647
}
16648+
else
16649+
{
16650+
this._cropRect = null;
1664716651

16652+
if (this.animations.isLoaded)
16653+
{
16654+
this.animations.refreshFrame();
16655+
}
16656+
else
16657+
{
16658+
this.setTexture(PIXI.TextureCache[this.key]);
16659+
}
16660+
}
1664816661
}
1664916662

1665016663
});
@@ -17705,6 +17718,7 @@ Phaser.Canvas = {
1770517718
* @return {HTMLCanvasElement} The newly created <canvas> tag.
1770617719
*/
1770717720
create: function (width, height) {
17721+
1770817722
width = width || 256;
1770917723
height = height || 256;
1771017724

@@ -24248,6 +24262,12 @@ Phaser.AnimationManager = function (sprite) {
2424824262
*/
2424924263
this.updateIfVisible = true;
2425024264

24265+
/**
24266+
* @property {boolean} isLoaded - Set to true once animation data has been loaded.
24267+
* @default
24268+
*/
24269+
this.isLoaded = false;
24270+
2425124271
/**
2425224272
* @property {Phaser.FrameData} _frameData - A temp. var for holding the currently playing Animations FrameData.
2425324273
* @private
@@ -24283,6 +24303,7 @@ Phaser.AnimationManager.prototype = {
2428324303

2428424304
this._frameData = frameData;
2428524305
this.frame = 0;
24306+
this.isLoaded = true;
2428624307

2428724308
},
2428824309

@@ -24464,6 +24485,18 @@ Phaser.AnimationManager.prototype = {
2446424485

2446524486
},
2446624487

24488+
/**
24489+
* Refreshes the current frame data back to the parent Sprite and also resets the texture data.
24490+
*
24491+
* @method Phaser.AnimationManager#refreshFrame
24492+
*/
24493+
refreshFrame: function () {
24494+
24495+
this.sprite.currentFrame = this.currentFrame;
24496+
this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
24497+
24498+
},
24499+
2446724500
/**
2446824501
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
2446924502
*
@@ -24552,7 +24585,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
2455224585

2455324586
set: function (value) {
2455424587

24555-
if (this._frameData && this._frameData.getFrame(value) !== null)
24588+
if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null)
2455624589
{
2455724590
this.currentFrame = this._frameData.getFrame(value);
2455824591
this._frameIndex = value;
@@ -24581,7 +24614,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", {
2458124614

2458224615
set: function (value) {
2458324616

24584-
if (this._frameData && this._frameData.getFrameByName(value) !== null)
24617+
if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null)
2458524618
{
2458624619
this.currentFrame = this._frameData.getFrameByName(value);
2458724620
this._frameIndex = this.currentFrame.index;
@@ -31491,8 +31524,12 @@ Phaser.Physics.Arcade.Body.prototype = {
3149131524

3149231525
this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
3149331526
this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31494-
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31495-
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31527+
31528+
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31529+
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31530+
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31531+
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31532+
3149631533
this.preRotation = this.sprite.angle;
3149731534

3149831535
this.x = this.preX;
@@ -31616,10 +31653,10 @@ Phaser.Physics.Arcade.Body.prototype = {
3161631653
this.angularVelocity = 0;
3161731654
this.angularAcceleration = 0;
3161831655

31619-
// this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31620-
// this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31621-
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31622-
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31656+
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31657+
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
31658+
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
31659+
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
3162331660
this.preRotation = this.sprite.angle;
3162431661

3162531662
this.x = this.preX;

examples/html/css/stylesheet.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ul.group-items > li a:visited span.mark{background: url('../img/group-item-hover
100100
.border-bottom{border-bottom: 1px solid #d1d1d1;}
101101

102102
.prize-bg{background: url('../img/prize-bg.png') no-repeat; background-size: cover; background-position: center center; height: 326px; width: 100%;}
103-
.gradient{background: url('../img/gradient-bg') repeat-y;}
103+
.gradient{background: url('../img/gradient-bg.jpg') repeat-y; width: 100%;}
104104
.prize-button{text-transform: uppercase; color: #000; text-shadow: 1px 0 #fff; float:right; background: url('../img/prize-button.png') no-repeat; width: 300px; height: 70px; padding-top:135px; font-size: 16px; padding-left: 75px; margin-top: 25px; margin-right: 145px;}
105105

106106
.footer{background: #e0e4f1 url('../img/footer-bg.jpg') no-repeat; background-size: cover; width:100%; height: 425px; bottom:0; color:#fff; text-shadow: 1px 1px 0 #000; line-height: 1.25em; font-size: 15px;}

examples/html/js/application.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ $(document).ready(function(){
2020
}else if((liAmount/4)>1){
2121
$(this).addClass('laser2');
2222
}
23-
console.log(liAmount/4);
23+
// console.log(liAmount/4);
2424
});
2525
});

examples/index.php

Lines changed: 109 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function printJSLinks($dir, $files) {
2929
foreach ($files as $key => $value)
3030
{
3131
$value2 = substr($value, 0, -4);
32-
echo "<a href=\"$dir/$value\" class=\"button\">$value2</a>";
32+
echo " <li><a href=\"$dir/$value\">$value2</a></li>\n";
3333
}
3434

3535
}
@@ -45,35 +45,126 @@ function printJSLinks($dir, $files) {
4545
}
4646
}
4747
?>
48-
<!DOCTYPE HTML>
49-
<head>
50-
<meta charset="utf-8" />
51-
<title>Phaser Examples</title>
52-
<link rel="stylesheet" href="phaser.css" type="text/css" />
53-
</head>
54-
<body>
55-
56-
<div id="header">
57-
<h1 id="title">Phaser Test Suite</h1>
48+
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
49+
<head>
50+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
51+
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
52+
<script src='html/js/application.js' type='text/javascript'></script>
53+
<link href='html/css/stylesheet.css' media='screen' rel='stylesheet' type='text/css'>
54+
</head>
55+
<body>
56+
<div class="header">
57+
<div class="box100 no-padding">
58+
<div class="phaser-version">
59+
<span>Phaser Version: 1.0.6</span>
60+
<a href="#" class="version-button">Update to 1.0.7</a>
61+
</div>
62+
</div>
63+
<div class="clear"></div>
64+
<div class="line">
65+
<div class="box20">
66+
<ul class="nav-links">
67+
<li class="link-home"><a href="http://phaser.io">Phaser Home</a></li>
68+
<li class="link-latest"><a href="https://github.com/photonstorm/phaser">Download Latest</a></li>
69+
<li class="link-forum"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Support Forum</a></li>
70+
<li class="link-docs"><a href="#">Documentation</a></li>
71+
<li class="link-twitter"><a href="https://twitter.com/photonstorm">Twitter</a></li>
72+
</ul>
73+
</div>
74+
<div class="box60 txt-center">
75+
<div class="phaser-examples"></div>
76+
</div>
77+
<div class="box20">
78+
<div class="phaser-logo"></div>
79+
</div>
80+
</div>
5881
</div>
59-
60-
<div id="links">
61-
82+
<div class="clear clear25"></div>
83+
<div class="line go-top border-bottom">
6284
<?php
63-
echo "<h2>Total Tests: $total </h2>";
85+
//echo "<h2>Total Tests: $total </h2>";
86+
87+
$i = 0;
6488

6589
foreach ($files as $key => $value)
6690
{
6791
// If $key is an array, output it as an h2 or something
6892
if (is_array($value) && count($value) > 0)
6993
{
70-
echo "<h2>$key (" . count($value) . " examples)</h2>";
94+
if ($i == 1)
95+
{
96+
?>
97+
<div class="clear5"></div>
98+
<div class="line dark-bg">
99+
<?php
100+
}
101+
else if ($i == 2)
102+
{
103+
?>
104+
<div class="clear5"></div>
105+
<div class="line bright-bg">
106+
<?php
107+
}
108+
?>
109+
<div class="box20">
110+
<p class="title strong"><?php echo $key ?></p>
111+
<p class="count-examples strong"><?php echo count($value) ?> examples</p>
112+
</div>
113+
<div class="box80">
114+
<ul class="group-items">
115+
<?php
71116
printJSLinks($key, $value);
72-
}
73117

118+
$i++;
119+
120+
if ($i == 3)
121+
{
122+
$i = 1;
123+
}
124+
}
125+
?>
126+
</ul>
127+
</div>
128+
</div>
129+
<?php
74130
}
75131
?>
132+
133+
<div class="clear5"></div>
134+
<div class="gradient">
135+
<div class="main-container centered">
136+
<div class="prize-bg">
137+
<a href="#" class="prize-button">View details &amp; submit</a>
138+
</div>
139+
</div>
76140
</div>
77141

78-
</body>
142+
<div class="clear"></div>
143+
<div class="footer">
144+
<div class="main-container centered">
145+
<div class="clear25"></div>
146+
<div class="line">
147+
<div class="box20 helvetica">
148+
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
149+
&copy; 2013 Photon Storm Ltd.<br/>
150+
All rights reserved.
151+
</div>
152+
<div class="box5">
153+
<div class="flixel-logo"></div>
154+
</div>
155+
<div class="box15 helvetica">
156+
Looking for a flash game framework?<br/>
157+
<a href="http://flixel.org">Try Flixel!</a>
158+
</div>
159+
<div class="box55 helvetica float-right">
160+
<ul class="footer-links">
161+
<li><a class="github-icon" href="https://github.com/photonstorm/phaser">Phaser on Github</a></li>
162+
<li><a class="twitter-icon" href="https://twitter.com/photonstorm">@photonstorm</a></li>
163+
<li><a class="forums-icon" href="http://www.html5gamedevs.com/forum/14-phaser/">Phaser Forums</a></li>
164+
</ul>
165+
</div>
166+
</div>
167+
</div>
168+
</div>
169+
</body>
79170
</html>

examples/js-physics.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)