Fixed issue where Phaser.Canvas.create would always make a screencanvas for CocoonJS, but that should only happen once. New parameter toggles it.

This commit is contained in:
photonstorm 2014-02-28 03:55:06 +00:00
parent 34ee2b0b20
commit 09d4a35b7f
14 changed files with 688 additions and 273 deletions

View file

@ -1,82 +0,0 @@
<?php
// NOTE: This script is deprecated. The build process is managed by grunt now.
// Keeping this file here for those that I know use it, but if you're trying to build fresh, use grunt.
date_default_timezone_set('Europe/London');
// Get the version number
// VERSION: '1.0.5',
$vf = file_get_contents(dirname(__FILE__) . '/../src/Phaser.js');
$version = substr($vf, strpos($vf, 'VERSION: ') + 10, 5);
$buildLog = "Building version $version \n\n";
$header = "";
$js = file(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.php');
$output = "";
for ($i = 0; $i < count($js); $i++)
{
// <script src="../src/Phaser.js"></script>
$line = trim($js[$i]);
if (strpos($line, '<script') !== false)
{
$line = str_replace('<script src="', '', $line);
$line = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('"></script>', '', $line);
$filename = substr($line, strrpos($line, '/') + 1);
$buildLog .= $line . "\n";
// echo $filename . "\n";
// Read the file in
if (file_exists($line))
{
$source = file_get_contents($line);
if ($filename == 'Intro.js')
{
// Built at: {buildDate}
$source = str_replace('{buildDate}', date('r'), $source);
// {version}
$source = str_replace('{version}', $version, $source);
// Set the header
$header = $source;
}
else
{
$output .= $source . "\n";
}
}
}
}
// 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(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>

View file

@ -10680,7 +10680,7 @@ World.prototype.hitTest = function(worldPoint,bodies,precision){
*
* Phaser - http://www.phaser.io
*
* v2.0.0 - Built at: Thu Feb 27 2014 16:59:28
* v2.0.0 - Built at: Fri Feb 28 2014 03:53:18
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -16598,7 +16598,7 @@ PIXI.PixiShader.prototype.initSampler2D = function(uniform)
var gl = this.gl;
gl.activeTexture(gl['TEXTURE' + this.textureCount]);
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTexture);
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
// Extended texture data
if (uniform.textureData)
@ -16672,7 +16672,6 @@ PIXI.PixiShader.prototype.syncUniforms = function()
// This would probably be faster in an array and it would guarantee key order
for (var key in this.uniforms)
{
uniform = this.uniforms[key];
if (uniform.glValueLength === 1)
@ -25354,7 +25353,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !!PIXI.scaleModes.LINEAR;
return !PIXI.scaleModes.LINEAR;
},
@ -26511,11 +26510,13 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) {
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
*
* @method Phaser.Group#destroy
* @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called?
* @param {boolean} [destroyChildren=true] - Should every child of this Group have its destroy method called?
*/
Phaser.Group.prototype.destroy = function (destroyChildren) {
if (typeof destroyChildren === 'undefined') { destroyChildren = false; }
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (destroyChildren)
{
@ -26525,7 +26526,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
{
if (this.children[0].parent)
{
this.children[0].destroy();
this.children[0].destroy(destroyChildren);
}
}
while (this.children.length > 0);
@ -27722,7 +27723,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
this.transparent = false;
/**
* @property {boolean} antialias - Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
* @property {boolean} antialias - Anti-alias graphics. By default scaled images are smoothed in Canvas and WebGL, set anti-alias to false to disable this globally.
* @default
*/
this.antialias = true;
@ -28188,10 +28189,7 @@ Phaser.Game.prototype = {
this.context = null;
}
if (!this.antialias)
{
this.stage.smoothed = false;
}
this.stage.smoothed = this.antialias;
Phaser.Canvas.addToDOM(this.canvas, this.parent, true);
Phaser.Canvas.setTouchAction(this.canvas);
@ -35008,7 +35006,7 @@ Phaser.BitmapData = function (game, key, width, height) {
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
* @default
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
@ -35831,8 +35829,13 @@ Phaser.Sprite.prototype.kill = function() {
*
* @method Phaser.Sprite#destroy
* @memberof Phaser.Sprite
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Sprite.prototype.destroy = function() {
Phaser.Sprite.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -35861,9 +35864,19 @@ Phaser.Sprite.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.alive = false;
@ -36304,7 +36317,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "smoothed", {
get: function () {
return !!this.texture.baseTexture.scaleMode;
return !this.texture.baseTexture.scaleMode;
},
@ -36696,8 +36709,13 @@ Phaser.Image.prototype.kill = function() {
*
* @method Phaser.Image#destroy
* @memberof Phaser.Image
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Image.prototype.destroy = function() {
Phaser.Image.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -36716,9 +36734,19 @@ Phaser.Image.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.alive = false;
@ -37039,7 +37067,7 @@ Object.defineProperty(Phaser.Image.prototype, "smoothed", {
get: function () {
return !!this.texture.baseTexture.scaleMode;
return !this.texture.baseTexture.scaleMode;
},
@ -37341,8 +37369,13 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
*
* @method Phaser.TileSprite#destroy
* @memberof Phaser.TileSprite
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.TileSprite.prototype.destroy = function() {
Phaser.TileSprite.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.filters)
{
@ -37360,9 +37393,19 @@ Phaser.TileSprite.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -37708,8 +37751,13 @@ Phaser.Text.prototype.postUpdate = function () {
/**
* @method Phaser.Text.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Text.prototype.destroy = function () {
Phaser.Text.prototype.destroy = function (destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -37730,9 +37778,19 @@ Phaser.Text.prototype.destroy = function () {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -38547,8 +38605,13 @@ Phaser.BitmapText.prototype.postUpdate = function () {
/**
* Destroy this BitmapText instance. This will remove any filters and un-parent any children.
* @method Phaser.BitmapText.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.BitmapText.prototype.destroy = function() {
Phaser.BitmapText.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -38557,9 +38620,26 @@ Phaser.BitmapText.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
if (this.children[i].destroy)
{
this.children[i].destroy(destroyChildren);
}
else
{
this.removeChild(this.children[i]);
}
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -39550,8 +39630,11 @@ Phaser.Graphics.prototype.postUpdate = function () {
* Destroy this Graphics instance.
*
* @method Phaser.Graphics.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Graphics.prototype.destroy = function() {
Phaser.Graphics.prototype.destroy = function(destroyChildren) {
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
this.clear();
@ -39560,6 +39643,23 @@ Phaser.Graphics.prototype.destroy = function() {
this.parent.remove(this);
}
var i = this.children.length;
if (destroyChildren)
{
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
this.visible = false;
@ -40346,16 +40446,26 @@ Phaser.Canvas = {
* @param {number} [width=256] - The width of the canvas element.
* @param {number} [height=256] - The height of the canvas element..
* @param {string} [id=''] - If given this will be set as the ID of the canvas element, otherwise no ID will be set.
* @param {boolean} [noCocoon=false] - CocoonJS only allows 1 screencanvas object, which should be your game. If you need to create another canvas (i.e. for a texture) set this to 'true'.
* @return {HTMLCanvasElement} The newly created canvas element.
*/
create: function (width, height, id) {
create: function (width, height, id, noCocoon) {
if (typeof noCocoon === 'undefined') { noCocoon = false; }
width = width || 256;
height = height || 256;
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
if (noCocoon)
{
var canvas = document.createElement('canvas');
}
else
{
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
}
if (typeof id === 'string')
if (typeof id === 'string' && id !== '')
{
canvas.id = id;
}
@ -41028,7 +41138,7 @@ Phaser.Device.prototype = {
*/
_checkFeatures: function () {
this.canvas = !!window['CanvasRenderingContext2D'] || this.iscocoonJS;
this.canvas = !!window['CanvasRenderingContext2D'] || this.cocoonJS;
try {
this.localStorage = !!localStorage.getItem;
@ -44942,6 +45052,7 @@ Phaser.Time.prototype = {
*/
boot: function () {
this._started = Date.now();
this.events.start();
},
@ -48918,6 +49029,31 @@ Phaser.Loader.prototype = {
},
/**
* Gets the fileList index for the given key.
*
* @method Phaser.Loader#getAssetIndex
* @param {string} type - The type asset you want to check.
* @param {string} key - Key of the asset you want to check.
* @return {number} The index of this key in the filelist, or -1 if not found.
*/
getAssetIndex: function (type, key) {
if (this._fileList.length > 0)
{
for (var i = 0; i < this._fileList.length; i++)
{
if (this._fileList[i].type === type && this._fileList[i].key === key)
{
return i;
}
}
}
return -1;
},
/**
* Gets the asset that is queued for load.
*
@ -49022,10 +49158,16 @@ Phaser.Loader.prototype = {
}
}
if (this.checkKeyExists(type, key) === false)
var index = this.getAssetIndex(type, key);
if (index === -1)
{
this._fileList.push(entry);
}
else
{
this._fileList[index] = entry;
}
},
@ -51872,6 +52014,7 @@ Phaser.Utils.Debug.prototype = {
this.line('World X: ' + pointer.worldX + " World Y: " + pointer.worldY);
this.line('Screen X: ' + pointer.x + " Screen Y: " + pointer.y);
this.line('Duration: ' + pointer.duration + " ms");
this.line('is Down: ' + pointer.isDown + " is Up: " + pointer.isUp);
this.stop();
},
@ -57680,11 +57823,16 @@ Phaser.Tilemap.prototype = {
* @method Phaser.Tilemap#getTileWorldXY
* @param {number} x - X position to get the tile from (given in pixels)
* @param {number} y - Y position to get the tile from (given in pixels)
* @param {number} [tileWidth] - The width of the tiles. If not given the map default is used.
* @param {number} [tileHeight] - The height of the tiles. If not given the map default is used.
* @param {number|string|Phaser.TilemapLayer} [layer] - The layer to get the tile from.
* @return {Phaser.Tile} The tile at the given coordinates.
*/
getTileWorldXY: function (x, y, tileWidth, tileHeight, layer) {
if (typeof tileWidth === 'undefined') { tileWidth = this.tileWidth; }
if (typeof tileHeight === 'undefined') { tileHeight = this.tileHeight; }
layer = this.getLayer(layer);
x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
@ -58138,7 +58286,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
/**
* @property {HTMLCanvasElement} canvas - The canvas to which this TilemapLayer draws.
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.

20
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -18,7 +18,7 @@
*
* Phaser - http://www.phaser.io
*
* v2.0.0.np - Built at: Thu Feb 27 2014 16:59:28
* v2.0.0.np - Built at: Fri Feb 28 2014 03:53:18
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -5936,7 +5936,7 @@ PIXI.PixiShader.prototype.initSampler2D = function(uniform)
var gl = this.gl;
gl.activeTexture(gl['TEXTURE' + this.textureCount]);
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTexture);
gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
// Extended texture data
if (uniform.textureData)
@ -6010,7 +6010,6 @@ PIXI.PixiShader.prototype.syncUniforms = function()
// This would probably be faster in an array and it would guarantee key order
for (var key in this.uniforms)
{
uniform = this.uniforms[key];
if (uniform.glValueLength === 1)
@ -14692,7 +14691,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !!PIXI.scaleModes.LINEAR;
return !PIXI.scaleModes.LINEAR;
},
@ -15849,11 +15848,13 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) {
* Destroys this Group. Removes all children, then removes the container from the display list and nulls references.
*
* @method Phaser.Group#destroy
* @param {boolean} [destroyChildren=false] - Should every child of this Group have its destroy method called?
* @param {boolean} [destroyChildren=true] - Should every child of this Group have its destroy method called?
*/
Phaser.Group.prototype.destroy = function (destroyChildren) {
if (typeof destroyChildren === 'undefined') { destroyChildren = false; }
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (destroyChildren)
{
@ -15863,7 +15864,7 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
{
if (this.children[0].parent)
{
this.children[0].destroy();
this.children[0].destroy(destroyChildren);
}
}
while (this.children.length > 0);
@ -24320,7 +24321,7 @@ Phaser.BitmapData = function (game, key, width, height) {
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
* @default
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.
@ -25143,8 +25144,13 @@ Phaser.Sprite.prototype.kill = function() {
*
* @method Phaser.Sprite#destroy
* @memberof Phaser.Sprite
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Sprite.prototype.destroy = function() {
Phaser.Sprite.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -25173,9 +25179,19 @@ Phaser.Sprite.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.alive = false;
@ -25616,7 +25632,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "smoothed", {
get: function () {
return !!this.texture.baseTexture.scaleMode;
return !this.texture.baseTexture.scaleMode;
},
@ -26008,8 +26024,13 @@ Phaser.Image.prototype.kill = function() {
*
* @method Phaser.Image#destroy
* @memberof Phaser.Image
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Image.prototype.destroy = function() {
Phaser.Image.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -26028,9 +26049,19 @@ Phaser.Image.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.alive = false;
@ -26351,7 +26382,7 @@ Object.defineProperty(Phaser.Image.prototype, "smoothed", {
get: function () {
return !!this.texture.baseTexture.scaleMode;
return !this.texture.baseTexture.scaleMode;
},
@ -26653,8 +26684,13 @@ Phaser.TileSprite.prototype.loadTexture = function (key, frame) {
*
* @method Phaser.TileSprite#destroy
* @memberof Phaser.TileSprite
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.TileSprite.prototype.destroy = function() {
Phaser.TileSprite.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.filters)
{
@ -26672,9 +26708,19 @@ Phaser.TileSprite.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -27020,8 +27066,13 @@ Phaser.Text.prototype.postUpdate = function () {
/**
* @method Phaser.Text.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Text.prototype.destroy = function () {
Phaser.Text.prototype.destroy = function (destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -27042,9 +27093,19 @@ Phaser.Text.prototype.destroy = function () {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -27859,8 +27920,13 @@ Phaser.BitmapText.prototype.postUpdate = function () {
/**
* Destroy this BitmapText instance. This will remove any filters and un-parent any children.
* @method Phaser.BitmapText.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.BitmapText.prototype.destroy = function() {
Phaser.BitmapText.prototype.destroy = function(destroyChildren) {
if (this.game === null) { return; }
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
if (this.parent)
{
@ -27869,9 +27935,26 @@ Phaser.BitmapText.prototype.destroy = function() {
var i = this.children.length;
while (i--)
if (destroyChildren)
{
this.removeChild(this.children[i]);
while (i--)
{
if (this.children[i].destroy)
{
this.children[i].destroy(destroyChildren);
}
else
{
this.removeChild(this.children[i]);
}
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
@ -28862,8 +28945,11 @@ Phaser.Graphics.prototype.postUpdate = function () {
* Destroy this Graphics instance.
*
* @method Phaser.Graphics.prototype.destroy
* @param {boolean} [destroyChildren=true] - Should every child of this object have its destroy method called?
*/
Phaser.Graphics.prototype.destroy = function() {
Phaser.Graphics.prototype.destroy = function(destroyChildren) {
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
this.clear();
@ -28872,6 +28958,23 @@ Phaser.Graphics.prototype.destroy = function() {
this.parent.remove(this);
}
var i = this.children.length;
if (destroyChildren)
{
while (i--)
{
this.children[i].destroy(destroyChildren);
}
}
else
{
while (i--)
{
this.removeChild(this.children[i]);
}
}
this.exists = false;
this.visible = false;
@ -29658,16 +29761,26 @@ Phaser.Canvas = {
* @param {number} [width=256] - The width of the canvas element.
* @param {number} [height=256] - The height of the canvas element..
* @param {string} [id=''] - If given this will be set as the ID of the canvas element, otherwise no ID will be set.
* @param {boolean} [noCocoon=false] - CocoonJS only allows 1 screencanvas object, which should be your game. If you need to create another canvas (i.e. for a texture) set this to 'true'.
* @return {HTMLCanvasElement} The newly created canvas element.
*/
create: function (width, height, id) {
create: function (width, height, id, noCocoon) {
if (typeof noCocoon === 'undefined') { noCocoon = false; }
width = width || 256;
height = height || 256;
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
if (noCocoon)
{
var canvas = document.createElement('canvas');
}
else
{
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
}
if (typeof id === 'string')
if (typeof id === 'string' && id !== '')
{
canvas.id = id;
}
@ -30340,7 +30453,7 @@ Phaser.Device.prototype = {
*/
_checkFeatures: function () {
this.canvas = !!window['CanvasRenderingContext2D'] || this.iscocoonJS;
this.canvas = !!window['CanvasRenderingContext2D'] || this.cocoonJS;
try {
this.localStorage = !!localStorage.getItem;
@ -34254,6 +34367,7 @@ Phaser.Time.prototype = {
*/
boot: function () {
this._started = Date.now();
this.events.start();
},
@ -38230,6 +38344,31 @@ Phaser.Loader.prototype = {
},
/**
* Gets the fileList index for the given key.
*
* @method Phaser.Loader#getAssetIndex
* @param {string} type - The type asset you want to check.
* @param {string} key - Key of the asset you want to check.
* @return {number} The index of this key in the filelist, or -1 if not found.
*/
getAssetIndex: function (type, key) {
if (this._fileList.length > 0)
{
for (var i = 0; i < this._fileList.length; i++)
{
if (this._fileList[i].type === type && this._fileList[i].key === key)
{
return i;
}
}
}
return -1;
},
/**
* Gets the asset that is queued for load.
*
@ -38334,10 +38473,16 @@ Phaser.Loader.prototype = {
}
}
if (this.checkKeyExists(type, key) === false)
var index = this.getAssetIndex(type, key);
if (index === -1)
{
this._fileList.push(entry);
}
else
{
this._fileList[index] = entry;
}
},
@ -41184,6 +41329,7 @@ Phaser.Utils.Debug.prototype = {
this.line('World X: ' + pointer.worldX + " World Y: " + pointer.worldY);
this.line('Screen X: ' + pointer.x + " Screen Y: " + pointer.y);
this.line('Duration: ' + pointer.duration + " ms");
this.line('is Down: ' + pointer.isDown + " is Up: " + pointer.isUp);
this.stop();
},
@ -43398,11 +43544,16 @@ Phaser.Tilemap.prototype = {
* @method Phaser.Tilemap#getTileWorldXY
* @param {number} x - X position to get the tile from (given in pixels)
* @param {number} y - Y position to get the tile from (given in pixels)
* @param {number} [tileWidth] - The width of the tiles. If not given the map default is used.
* @param {number} [tileHeight] - The height of the tiles. If not given the map default is used.
* @param {number|string|Phaser.TilemapLayer} [layer] - The layer to get the tile from.
* @return {Phaser.Tile} The tile at the given coordinates.
*/
getTileWorldXY: function (x, y, tileWidth, tileHeight, layer) {
if (typeof tileWidth === 'undefined') { tileWidth = this.tileWidth; }
if (typeof tileHeight === 'undefined') { tileHeight = this.tileHeight; }
layer = this.getLayer(layer);
x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
@ -43856,7 +44007,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
/**
* @property {HTMLCanvasElement} canvas - The canvas to which this TilemapLayer draws.
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,8 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('pic', '../assets/pics/questar.png');
game.load.image('pic', '/phaser/examples/assets/pics/1984-nocooper-space.png');
}
@ -12,26 +11,26 @@ var bmd;
function create() {
game.add.image(0, 0, 'pic');
console.log('pic box 11');
console.log('pic?');
game.add.sprite(0, 0, 'pic');
// bmd = game.add.bitmapData(800, 600);
// bmd.context.fillStyle = 'rgba(255,0,0,0.2)';
// bmd.context.fillRect(0, 0, 300, 100);
bmd = game.add.bitmapData(800, 600);
bmd.context.fillStyle = 'rgba(255,0,0,1)';
bmd.context.fillRect(0, 0, 300, 100);
// image = game.add.image(0, 0, bmd);
image = game.add.image(0, 100, bmd);
}
function update() {
// bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
bmd.context.fillRect(game.input.x, game.input.y, 8, 8);
}
function render() {
// game.debug.renderText(game.input.x, 32, 32);
game.debug.renderText(game.input.x, 32, 32);
}

View file

@ -1,12 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="../../dist/phaser.js" type="text/javascript"></script>
<script src="bmd.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>

View file

@ -1,88 +1,17 @@
<?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/index.php?f=$file\">$value2</a><br />";
}
return $output;
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<base href="../" />
<?php
require('../../build/config.php');
if (isset($_GET['f']))
{
$f = $_GET['f'];
?>
<script src="../../dist/phaser.js" type="text/javascript"></script>
<script src="<?php echo $f?>" type="text/javascript"></script>
<script src="wip/<?php echo $f?>" type="text/javascript"></script>
<?php
}
?>

View file

@ -0,0 +1,136 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="/phaser/build/p2.js"></script>
<script src="/phaser/src/Intro.js"></script>
<script src="/phaser/src/pixi/Pixi.js"></script>
<script src="/phaser/src/Phaser.js"></script>
<script src="/phaser/src/utils/Utils.js"></script>
<script src="/phaser/src/geom/Circle.js"></script>
<script src="/phaser/src/geom/Point.js"></script>
<script src="/phaser/src/geom/Rectangle.js"></script>
<script src="/phaser/src/geom/Line.js"></script>
<script src="/phaser/src/geom/Ellipse.js"></script>
<script src="/phaser/src/geom/Polygon.js"></script>
<script src="/phaser/src/pixi/core/Matrix.js"></script>
<script src="/phaser/src/pixi/display/DisplayObject.js"></script>
<script src="/phaser/src/pixi/display/DisplayObjectContainer.js"></script>
<script src="/phaser/src/pixi/display/Sprite.js"></script>
<script src="/phaser/src/pixi/display/SpriteBatch.js"></script>
<script src="/phaser/src/pixi/filters/FilterBlock.js"></script>
<script src="/phaser/src/pixi/text/Text.js"></script>
<script src="/phaser/src/pixi/text/BitmapText.js"></script>
<script src="/phaser/src/pixi/display/Stage.js"></script>
<script src="/phaser/src/pixi/utils/EventTarget.js"></script>
<script src="/phaser/src/pixi/utils/Polyk.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="/phaser/src/pixi/primitives/Graphics.js"></script>
<script src="/phaser/src/pixi/extras/TilingSprite.js"></script>
<script src="/phaser/src/pixi/textures/BaseTexture.js"></script>
<script src="/phaser/src/pixi/textures/Texture.js"></script>
<script src="/phaser/src/pixi/textures/RenderTexture.js"></script>
<script src="/phaser/src/core/Camera.js"></script>
<script src="/phaser/src/core/State.js"></script>
<script src="/phaser/src/core/StateManager.js"></script>
<script src="/phaser/src/core/LinkedList.js"></script>
<script src="/phaser/src/core/Signal.js"></script>
<script src="/phaser/src/core/SignalBinding.js"></script>
<script src="/phaser/src/core/Filter.js"></script>
<script src="/phaser/src/core/Plugin.js"></script>
<script src="/phaser/src/core/PluginManager.js"></script>
<script src="/phaser/src/core/Stage.js"></script>
<script src="/phaser/src/core/Group.js"></script>
<script src="/phaser/src/core/World.js"></script>
<script src="/phaser/src/core/Game.js"></script>
<script src="/phaser/src/core/ScaleManager.js"></script>
<script src="/phaser/src/input/Input.js"></script>
<script src="/phaser/src/input/Key.js"></script>
<script src="/phaser/src/input/Keyboard.js"></script>
<script src="/phaser/src/input/Mouse.js"></script>
<script src="/phaser/src/input/MSPointer.js"></script>
<script src="/phaser/src/input/Pointer.js"></script>
<script src="/phaser/src/input/Touch.js"></script>
<script src="/phaser/src/input/Gamepad.js"></script>
<script src="/phaser/src/input/SinglePad.js"></script>
<script src="/phaser/src/input/GamepadButton.js"></script>
<script src="/phaser/src/input/InputHandler.js"></script>
<script src="/phaser/src/gameobjects/Events.js"></script>
<script src="/phaser/src/gameobjects/GameObjectCreator.js"></script>
<script src="/phaser/src/gameobjects/GameObjectFactory.js"></script>
<script src="/phaser/src/gameobjects/BitmapData.js"></script>
<script src="/phaser/src/gameobjects/Sprite.js"></script>
<script src="/phaser/src/gameobjects/Image.js"></script>
<script src="/phaser/src/gameobjects/TileSprite.js"></script>
<script src="/phaser/src/gameobjects/Text.js"></script>
<script src="/phaser/src/gameobjects/BitmapText.js"></script>
<script src="/phaser/src/gameobjects/Button.js"></script>
<script src="/phaser/src/gameobjects/Graphics.js"></script>
<script src="/phaser/src/gameobjects/RenderTexture.js"></script>
<script src="/phaser/src/gameobjects/SpriteBatch.js"></script>
<script src="/phaser/src/gameobjects/BitmapFont.js"></script>
<script src="/phaser/src/system/Canvas.js"></script>
<script src="/phaser/src/system/Device.js"></script>
<script src="/phaser/src/system/RequestAnimationFrame.js"></script>
<script src="/phaser/src/math/Math.js"></script>
<script src="/phaser/src/math/RandomDataGenerator.js"></script>
<script src="/phaser/src/net/Net.js"></script>
<script src="/phaser/src/tween/TweenManager.js"></script>
<script src="/phaser/src/tween/Tween.js"></script>
<script src="/phaser/src/tween/Easing.js"></script>
<script src="/phaser/src/time/Time.js"></script>
<script src="/phaser/src/time/Timer.js"></script>
<script src="/phaser/src/time/TimerEvent.js"></script>
<script src="/phaser/src/animation/AnimationManager.js"></script>
<script src="/phaser/src/animation/Animation.js"></script>
<script src="/phaser/src/animation/Frame.js"></script>
<script src="/phaser/src/animation/FrameData.js"></script>
<script src="/phaser/src/animation/AnimationParser.js"></script>
<script src="/phaser/src/loader/Cache.js"></script>
<script src="/phaser/src/loader/Loader.js"></script>
<script src="/phaser/src/loader/LoaderParser.js"></script>
<script src="/phaser/src/sound/Sound.js"></script>
<script src="/phaser/src/sound/SoundManager.js"></script>
<script src="/phaser/src/utils/Debug.js"></script>
<script src="/phaser/src/utils/Color.js"></script>
<script src="/phaser/src/physics/World.js"></script>
<script src="/phaser/src/physics/PointProxy.js"></script>
<script src="/phaser/src/physics/InversePointProxy.js"></script>
<script src="/phaser/src/physics/Body.js"></script>
<script src="/phaser/src/physics/Spring.js"></script>
<script src="/phaser/src/physics/Material.js"></script>
<script src="/phaser/src/physics/ContactMaterial.js"></script>
<script src="/phaser/src/physics/CollisionGroup.js"></script>
<script src="/phaser/src/particles/Particles.js"></script>
<script src="/phaser/src/particles/arcade/ArcadeParticles.js"></script>
<script src="/phaser/src/particles/arcade/Emitter.js"></script>
<script src="/phaser/src/tilemap/Tile.js"></script>
<script src="/phaser/src/tilemap/Tilemap.js"></script>
<script src="/phaser/src/tilemap/TilemapLayer.js"></script>
<script src="/phaser/src/tilemap/TilemapParser.js"></script>
<script src="/phaser/src/tilemap/Tileset.js"></script>
<script src="/phaser/examples/wip/bmd.js" type="text/javascript"></script>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>

View file

@ -0,0 +1,136 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>phaser</title>
<script src="/phaser/build/p2.js"></script>
<script src="/phaser/src/Intro.js"></script>
<script src="/phaser/src/pixi/Pixi.js"></script>
<script src="/phaser/src/Phaser.js"></script>
<script src="/phaser/src/utils/Utils.js"></script>
<script src="/phaser/src/geom/Circle.js"></script>
<script src="/phaser/src/geom/Point.js"></script>
<script src="/phaser/src/geom/Rectangle.js"></script>
<script src="/phaser/src/geom/Line.js"></script>
<script src="/phaser/src/geom/Ellipse.js"></script>
<script src="/phaser/src/geom/Polygon.js"></script>
<script src="/phaser/src/pixi/core/Matrix.js"></script>
<script src="/phaser/src/pixi/display/DisplayObject.js"></script>
<script src="/phaser/src/pixi/display/DisplayObjectContainer.js"></script>
<script src="/phaser/src/pixi/display/Sprite.js"></script>
<script src="/phaser/src/pixi/display/SpriteBatch.js"></script>
<script src="/phaser/src/pixi/filters/FilterBlock.js"></script>
<script src="/phaser/src/pixi/text/Text.js"></script>
<script src="/phaser/src/pixi/text/BitmapText.js"></script>
<script src="/phaser/src/pixi/display/Stage.js"></script>
<script src="/phaser/src/pixi/utils/EventTarget.js"></script>
<script src="/phaser/src/pixi/utils/Polyk.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="/phaser/src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="/phaser/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="/phaser/src/pixi/primitives/Graphics.js"></script>
<script src="/phaser/src/pixi/extras/TilingSprite.js"></script>
<script src="/phaser/src/pixi/textures/BaseTexture.js"></script>
<script src="/phaser/src/pixi/textures/Texture.js"></script>
<script src="/phaser/src/pixi/textures/RenderTexture.js"></script>
<script src="/phaser/src/core/Camera.js"></script>
<script src="/phaser/src/core/State.js"></script>
<script src="/phaser/src/core/StateManager.js"></script>
<script src="/phaser/src/core/LinkedList.js"></script>
<script src="/phaser/src/core/Signal.js"></script>
<script src="/phaser/src/core/SignalBinding.js"></script>
<script src="/phaser/src/core/Filter.js"></script>
<script src="/phaser/src/core/Plugin.js"></script>
<script src="/phaser/src/core/PluginManager.js"></script>
<script src="/phaser/src/core/Stage.js"></script>
<script src="/phaser/src/core/Group.js"></script>
<script src="/phaser/src/core/World.js"></script>
<script src="/phaser/src/core/Game.js"></script>
<script src="/phaser/src/core/ScaleManager.js"></script>
<script src="/phaser/src/input/Input.js"></script>
<script src="/phaser/src/input/Key.js"></script>
<script src="/phaser/src/input/Keyboard.js"></script>
<script src="/phaser/src/input/Mouse.js"></script>
<script src="/phaser/src/input/MSPointer.js"></script>
<script src="/phaser/src/input/Pointer.js"></script>
<script src="/phaser/src/input/Touch.js"></script>
<script src="/phaser/src/input/Gamepad.js"></script>
<script src="/phaser/src/input/SinglePad.js"></script>
<script src="/phaser/src/input/GamepadButton.js"></script>
<script src="/phaser/src/input/InputHandler.js"></script>
<script src="/phaser/src/gameobjects/Events.js"></script>
<script src="/phaser/src/gameobjects/GameObjectCreator.js"></script>
<script src="/phaser/src/gameobjects/GameObjectFactory.js"></script>
<script src="/phaser/src/gameobjects/BitmapData.js"></script>
<script src="/phaser/src/gameobjects/Sprite.js"></script>
<script src="/phaser/src/gameobjects/Image.js"></script>
<script src="/phaser/src/gameobjects/TileSprite.js"></script>
<script src="/phaser/src/gameobjects/Text.js"></script>
<script src="/phaser/src/gameobjects/BitmapText.js"></script>
<script src="/phaser/src/gameobjects/Button.js"></script>
<script src="/phaser/src/gameobjects/Graphics.js"></script>
<script src="/phaser/src/gameobjects/RenderTexture.js"></script>
<script src="/phaser/src/gameobjects/SpriteBatch.js"></script>
<script src="/phaser/src/gameobjects/BitmapFont.js"></script>
<script src="/phaser/src/system/Canvas.js"></script>
<script src="/phaser/src/system/Device.js"></script>
<script src="/phaser/src/system/RequestAnimationFrame.js"></script>
<script src="/phaser/src/math/Math.js"></script>
<script src="/phaser/src/math/RandomDataGenerator.js"></script>
<script src="/phaser/src/net/Net.js"></script>
<script src="/phaser/src/tween/TweenManager.js"></script>
<script src="/phaser/src/tween/Tween.js"></script>
<script src="/phaser/src/tween/Easing.js"></script>
<script src="/phaser/src/time/Time.js"></script>
<script src="/phaser/src/time/Timer.js"></script>
<script src="/phaser/src/time/TimerEvent.js"></script>
<script src="/phaser/src/animation/AnimationManager.js"></script>
<script src="/phaser/src/animation/Animation.js"></script>
<script src="/phaser/src/animation/Frame.js"></script>
<script src="/phaser/src/animation/FrameData.js"></script>
<script src="/phaser/src/animation/AnimationParser.js"></script>
<script src="/phaser/src/loader/Cache.js"></script>
<script src="/phaser/src/loader/Loader.js"></script>
<script src="/phaser/src/loader/LoaderParser.js"></script>
<script src="/phaser/src/sound/Sound.js"></script>
<script src="/phaser/src/sound/SoundManager.js"></script>
<script src="/phaser/src/utils/Debug.js"></script>
<script src="/phaser/src/utils/Color.js"></script>
<script src="/phaser/src/physics/World.js"></script>
<script src="/phaser/src/physics/PointProxy.js"></script>
<script src="/phaser/src/physics/InversePointProxy.js"></script>
<script src="/phaser/src/physics/Body.js"></script>
<script src="/phaser/src/physics/Spring.js"></script>
<script src="/phaser/src/physics/Material.js"></script>
<script src="/phaser/src/physics/ContactMaterial.js"></script>
<script src="/phaser/src/physics/CollisionGroup.js"></script>
<script src="/phaser/src/particles/Particles.js"></script>
<script src="/phaser/src/particles/arcade/ArcadeParticles.js"></script>
<script src="/phaser/src/particles/arcade/Emitter.js"></script>
<script src="/phaser/src/tilemap/Tile.js"></script>
<script src="/phaser/src/tilemap/Tilemap.js"></script>
<script src="/phaser/src/tilemap/TilemapLayer.js"></script>
<script src="/phaser/src/tilemap/TilemapParser.js"></script>
<script src="/phaser/src/tilemap/Tileset.js"></script>
<script src="/phaser/examples/wip/bmd.js" type="text/javascript"></script>
</head>
<body>
<div id="phaser-example"></div>
</body>
</html>

View file

@ -64,7 +64,7 @@
$value2 = substr($value, 0, -3);
$file = urlencode($value);
$output .= "<tr><td><a href=\"wip/index.php?f=$file\">$value2</a></td><td><a href=\"wip/index-fs.php?f=$file\">(full screen)</a></td><td><a href=\"wip/cocoon.php?f=$file\">(cocoon)</a></td></tr>";
$output .= "<tr><td><a href=\"wip/index.php?f=$file\">$value2</a></td><td><a href=\"wip/index-fs.php?f=$file\">(full screen)</a></td><td><a href=\"wip/index-cocoon.php?f=$file\">(cocoon)</a></td></tr>";
}
return $output;

View file

@ -47,7 +47,7 @@ Phaser.BitmapData = function (game, key, width, height) {
* @property {HTMLCanvasElement} canvas - The canvas to which this BitmapData draws.
* @default
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.

View file

@ -19,16 +19,26 @@ Phaser.Canvas = {
* @param {number} [width=256] - The width of the canvas element.
* @param {number} [height=256] - The height of the canvas element..
* @param {string} [id=''] - If given this will be set as the ID of the canvas element, otherwise no ID will be set.
* @param {boolean} [noCocoon=false] - CocoonJS only allows 1 screencanvas object, which should be your game. If you need to create another canvas (i.e. for a texture) set this to 'true'.
* @return {HTMLCanvasElement} The newly created canvas element.
*/
create: function (width, height, id) {
create: function (width, height, id, noCocoon) {
if (typeof noCocoon === 'undefined') { noCocoon = false; }
width = width || 256;
height = height || 256;
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
if (noCocoon)
{
var canvas = document.createElement('canvas');
}
else
{
var canvas = document.createElement(navigator.isCocoonJS ? 'screencanvas' : 'canvas');
}
if (typeof id === 'string')
if (typeof id === 'string' && id !== '')
{
canvas.id = id;
}

View file

@ -40,7 +40,7 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
/**
* @property {HTMLCanvasElement} canvas - The canvas to which this TilemapLayer draws.
*/
this.canvas = Phaser.Canvas.create(width, height);
this.canvas = Phaser.Canvas.create(width, height, '', true);
/**
* @property {CanvasRenderingContext2D} context - The 2d context of the canvas.