mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
New examples page
This commit is contained in:
@@ -126,6 +126,11 @@ Version 1.0.7 (in progress in the dev branch)
|
||||
* Added Text.destroy() and BitmapText.destroy(), also updated Group.remove to make it more bullet-proof when an element doesn't have any events.
|
||||
* Added Phaser.Utils.shuffle to shuffle an array.
|
||||
* Added Graphics.destroy, x, y and updated angle functions.
|
||||
* Additional checks added to AnimationManager.frame/frameName on the given values.
|
||||
* Added AnimationManager.refreshFrame - will reset the texture being used for a Sprite (useful after a crop rect clear)
|
||||
* You can now null a Sprite.crop and it will clear down the crop rect area correctly.
|
||||
* 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.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+47
-10
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* Phaser - http://www.phaser.io
|
||||
*
|
||||
* v1.0.7 - Built at: Thu, 17 Oct 2013 22:56:02 +0100
|
||||
* v1.0.7 - Built at: Fri, 18 Oct 2013 01:36:29 +0100
|
||||
*
|
||||
* By Richard Davey http://www.photonstorm.com @photonstorm
|
||||
*
|
||||
@@ -10948,8 +10948,9 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
||||
renderer = renderer || Phaser.AUTO;
|
||||
parent = parent || '';
|
||||
state = state || null;
|
||||
|
||||
if (typeof transparent == 'undefined') { transparent = false; }
|
||||
if (typeof antialias == 'undefined') { antialias = false; }
|
||||
if (typeof antialias == 'undefined') { antialias = true; }
|
||||
|
||||
/**
|
||||
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
|
||||
@@ -16644,7 +16645,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "crop", {
|
||||
this._cropRect = value;
|
||||
this.setTexture(PIXI.TextureCache[this._cropUUID]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._cropRect = null;
|
||||
|
||||
if (this.animations.isLoaded)
|
||||
{
|
||||
this.animations.refreshFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setTexture(PIXI.TextureCache[this.key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -17705,6 +17718,7 @@ Phaser.Canvas = {
|
||||
* @return {HTMLCanvasElement} The newly created <canvas> tag.
|
||||
*/
|
||||
create: function (width, height) {
|
||||
|
||||
width = width || 256;
|
||||
height = height || 256;
|
||||
|
||||
@@ -24248,6 +24262,12 @@ Phaser.AnimationManager = function (sprite) {
|
||||
*/
|
||||
this.updateIfVisible = true;
|
||||
|
||||
/**
|
||||
* @property {boolean} isLoaded - Set to true once animation data has been loaded.
|
||||
* @default
|
||||
*/
|
||||
this.isLoaded = false;
|
||||
|
||||
/**
|
||||
* @property {Phaser.FrameData} _frameData - A temp. var for holding the currently playing Animations FrameData.
|
||||
* @private
|
||||
@@ -24283,6 +24303,7 @@ Phaser.AnimationManager.prototype = {
|
||||
|
||||
this._frameData = frameData;
|
||||
this.frame = 0;
|
||||
this.isLoaded = true;
|
||||
|
||||
},
|
||||
|
||||
@@ -24464,6 +24485,18 @@ Phaser.AnimationManager.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes the current frame data back to the parent Sprite and also resets the texture data.
|
||||
*
|
||||
* @method Phaser.AnimationManager#refreshFrame
|
||||
*/
|
||||
refreshFrame: function () {
|
||||
|
||||
this.sprite.currentFrame = this.currentFrame;
|
||||
this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
|
||||
*
|
||||
@@ -24552,7 +24585,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (this._frameData && this._frameData.getFrame(value) !== null)
|
||||
if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null)
|
||||
{
|
||||
this.currentFrame = this._frameData.getFrame(value);
|
||||
this._frameIndex = value;
|
||||
@@ -24581,7 +24614,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (this._frameData && this._frameData.getFrameByName(value) !== null)
|
||||
if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null)
|
||||
{
|
||||
this.currentFrame = this._frameData.getFrameByName(value);
|
||||
this._frameIndex = this.currentFrame.index;
|
||||
@@ -31491,8 +31524,12 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
|
||||
this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
this.x = this.preX;
|
||||
@@ -31616,10 +31653,10 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
this.angularVelocity = 0;
|
||||
this.angularAcceleration = 0;
|
||||
|
||||
// this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
this.x = this.preX;
|
||||
|
||||
@@ -100,7 +100,7 @@ ul.group-items > li a:visited span.mark{background: url('../img/group-item-hover
|
||||
.border-bottom{border-bottom: 1px solid #d1d1d1;}
|
||||
|
||||
.prize-bg{background: url('../img/prize-bg.png') no-repeat; background-size: cover; background-position: center center; height: 326px; width: 100%;}
|
||||
.gradient{background: url('../img/gradient-bg') repeat-y;}
|
||||
.gradient{background: url('../img/gradient-bg.jpg') repeat-y; width: 100%;}
|
||||
.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;}
|
||||
|
||||
.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;}
|
||||
|
||||
@@ -20,6 +20,6 @@ $(document).ready(function(){
|
||||
}else if((liAmount/4)>1){
|
||||
$(this).addClass('laser2');
|
||||
}
|
||||
console.log(liAmount/4);
|
||||
// console.log(liAmount/4);
|
||||
});
|
||||
});
|
||||
+109
-18
@@ -29,7 +29,7 @@
|
||||
foreach ($files as $key => $value)
|
||||
{
|
||||
$value2 = substr($value, 0, -4);
|
||||
echo "<a href=\"$dir/$value\" class=\"button\">$value2</a>";
|
||||
echo " <li><a href=\"$dir/$value\">$value2</a></li>\n";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,35 +45,126 @@
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Phaser Examples</title>
|
||||
<link rel="stylesheet" href="phaser.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
<h1 id="title">Phaser Test Suite</h1>
|
||||
<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='html/js/application.js' type='text/javascript'></script>
|
||||
<link href='html/css/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.0.6</span>
|
||||
<a href="#" class="version-button">Update to 1.0.7</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 id="links">
|
||||
|
||||
<div class="clear clear25"></div>
|
||||
<div class="line go-top border-bottom">
|
||||
<?php
|
||||
echo "<h2>Total Tests: $total </h2>";
|
||||
//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)
|
||||
{
|
||||
echo "<h2>$key (" . count($value) . " examples)</h2>";
|
||||
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
|
||||
printJSLinks($key, $value);
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
if ($i == 3)
|
||||
{
|
||||
$i = 1;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="clear5"></div>
|
||||
<div class="gradient">
|
||||
<div class="main-container centered">
|
||||
<div class="prize-bg">
|
||||
<a href="#" class="prize-button">View details & submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<div class="clear"></div>
|
||||
<div class="footer">
|
||||
<div class="main-container centered">
|
||||
<div class="clear25"></div>
|
||||
<div class="line">
|
||||
<div class="box20 helvetica">
|
||||
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
|
||||
© 2013 Photon Storm Ltd.<br/>
|
||||
All rights reserved.
|
||||
</div>
|
||||
<div class="box5">
|
||||
<div class="flixel-logo"></div>
|
||||
</div>
|
||||
<div class="box15 helvetica">
|
||||
Looking for a flash game framework?<br/>
|
||||
<a href="http://flixel.org">Try Flixel!</a>
|
||||
</div>
|
||||
<div class="box55 helvetica 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>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
// All JS files in build order.
|
||||
// Much easier for debugging
|
||||
?>
|
||||
<script src="../src/physics/advanced/Math.js"></script>
|
||||
<script src="../src/physics/advanced/Util.js"></script>
|
||||
<script src="../src/physics/advanced/Collision.js"></script>
|
||||
<script src="../src/physics/advanced/Body.js"></script>
|
||||
<script src="../src/physics/advanced/Joint.js"></script>
|
||||
<script src="../src/physics/advanced/Shape.js"></script>
|
||||
<script src="../src/physics/advanced/Contact.js"></script>
|
||||
<script src="../src/physics/advanced/ContactSolver.js"></script>
|
||||
<script src="../src/physics/advanced/Space.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Angle.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Revolute.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Weld.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Wheel.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Prismatic.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Distance.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Rope.js"></script>
|
||||
<script src="../src/physics/advanced/joints/Mouse.js"></script>
|
||||
<script src="../src/physics/advanced/shapes/Circle.js"></script>
|
||||
<script src="../src/physics/advanced/shapes/Segment.js"></script>
|
||||
<script src="../src/physics/advanced/shapes/Poly.js"></script>
|
||||
<script src="../src/physics/advanced/shapes/Triangle.js"></script>
|
||||
<script src="../src/physics/advanced/shapes/Box.js"></script>
|
||||
@@ -36,6 +36,12 @@ Phaser.AnimationManager = function (sprite) {
|
||||
*/
|
||||
this.updateIfVisible = true;
|
||||
|
||||
/**
|
||||
* @property {boolean} isLoaded - Set to true once animation data has been loaded.
|
||||
* @default
|
||||
*/
|
||||
this.isLoaded = false;
|
||||
|
||||
/**
|
||||
* @property {Phaser.FrameData} _frameData - A temp. var for holding the currently playing Animations FrameData.
|
||||
* @private
|
||||
@@ -71,6 +77,7 @@ Phaser.AnimationManager.prototype = {
|
||||
|
||||
this._frameData = frameData;
|
||||
this.frame = 0;
|
||||
this.isLoaded = true;
|
||||
|
||||
},
|
||||
|
||||
@@ -252,6 +259,18 @@ Phaser.AnimationManager.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes the current frame data back to the parent Sprite and also resets the texture data.
|
||||
*
|
||||
* @method Phaser.AnimationManager#refreshFrame
|
||||
*/
|
||||
refreshFrame: function () {
|
||||
|
||||
this.sprite.currentFrame = this.currentFrame;
|
||||
this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
|
||||
*
|
||||
@@ -340,7 +359,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frame", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (this._frameData && this._frameData.getFrame(value) !== null)
|
||||
if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null)
|
||||
{
|
||||
this.currentFrame = this._frameData.getFrame(value);
|
||||
this._frameIndex = value;
|
||||
@@ -369,7 +388,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, "frameName", {
|
||||
|
||||
set: function (value) {
|
||||
|
||||
if (this._frameData && this._frameData.getFrameByName(value) !== null)
|
||||
if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null)
|
||||
{
|
||||
this.currentFrame = this._frameData.getFrameByName(value);
|
||||
this._frameIndex = this.currentFrame.index;
|
||||
|
||||
+2
-1
@@ -29,8 +29,9 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
|
||||
renderer = renderer || Phaser.AUTO;
|
||||
parent = parent || '';
|
||||
state = state || null;
|
||||
|
||||
if (typeof transparent == 'undefined') { transparent = false; }
|
||||
if (typeof antialias == 'undefined') { antialias = false; }
|
||||
if (typeof antialias == 'undefined') { antialias = true; }
|
||||
|
||||
/**
|
||||
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
|
||||
|
||||
@@ -880,7 +880,19 @@ Object.defineProperty(Phaser.Sprite.prototype, "crop", {
|
||||
this._cropRect = value;
|
||||
this.setTexture(PIXI.TextureCache[this._cropUUID]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._cropRect = null;
|
||||
|
||||
if (this.animations.isLoaded)
|
||||
{
|
||||
this.animations.refreshFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setTexture(PIXI.TextureCache[this.key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -112,8 +112,12 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
|
||||
this.screenX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.screenY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
this.x = this.preX;
|
||||
@@ -237,10 +241,10 @@ Phaser.Physics.Arcade.Body.prototype = {
|
||||
this.angularVelocity = 0;
|
||||
this.angularAcceleration = 0;
|
||||
|
||||
// this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preX = (this.sprite.worldTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
this.preY = (this.sprite.worldTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
// this.preX = (this.sprite.localTransform[2] - (this.sprite.anchor.x * this.width)) + this.offset.x;
|
||||
// this.preY = (this.sprite.localTransform[5] - (this.sprite.anchor.y * this.height)) + this.offset.y;
|
||||
this.preRotation = this.sprite.angle;
|
||||
|
||||
this.x = this.preX;
|
||||
|
||||
@@ -21,6 +21,7 @@ Phaser.Canvas = {
|
||||
* @return {HTMLCanvasElement} The newly created <canvas> tag.
|
||||
*/
|
||||
create: function (width, height) {
|
||||
|
||||
width = width || 256;
|
||||
height = height || 256;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user