diff --git a/README.md b/README.md index 050dcdf6..285a255a 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,9 @@ Version 1.0.7 (in progress in the dev branch) * Phaser.Animation.FrameData is now Phaser.FrameData * Phaser.Animation.Parser is now Phaser.AnimationParser (also the file has renamed from Parser.js to AnimationParser.js) * Phaser.Loader.Parser is now Phaser.LoaderParser (also the file has renamed from Parser.js to LoaderParser.js) +* Fixed Cache.addDefaultImage so the default image works in Canvas as well as WebGL. Updated to a new image (32x32 black square with green outline) +* Extended the Loader 404 error to display the url of the file that didn't load as well as the key. + diff --git a/examples/assets/sprites/default.png b/examples/assets/sprites/default.png new file mode 100644 index 00000000..7f288b83 Binary files /dev/null and b/examples/assets/sprites/default.png differ diff --git a/examples/head.php b/examples/head.php index 4121f0e6..b401c577 100644 --- a/examples/head.php +++ b/examples/head.php @@ -1,4 +1,4 @@ - +
diff --git a/examples/text/bitmap fonts.php b/examples/text/bitmap fonts.php index 27c7c9fb..dc1716e9 100644 --- a/examples/text/bitmap fonts.php +++ b/examples/text/bitmap fonts.php @@ -7,7 +7,7 @@ (function () { - var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create }); + var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload() { @@ -15,9 +15,17 @@ } + var text; + function create() { - game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' }); + text = game.add.bitmapText(200, 100, 'Phaser & Pixi\nrocking!', { font: '64px Desyrel', align: 'center' }); + + } + + function update() { + + text.setText('Phaser & Pixi\nrocking!\n' + Math.round(game.time.now)); } diff --git a/examples/world/move around world.php b/examples/world/move around world.php new file mode 100644 index 00000000..adc02a99 --- /dev/null +++ b/examples/world/move around world.php @@ -0,0 +1,111 @@ + + + + + + diff --git a/src/PixiPatch.js b/src/PixiPatch.js index c1bfe366..0cdf89d7 100644 --- a/src/PixiPatch.js +++ b/src/PixiPatch.js @@ -29,7 +29,8 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject) continue; } - if(!displayObject.renderable || displayObject.alpha == 0) + // if(!displayObject.renderable || displayObject.alpha == 0) + if(!displayObject.renderable) { displayObject = displayObject._iNext; continue; diff --git a/src/core/Camera.js b/src/core/Camera.js index 219098e7..0e7c27a7 100644 --- a/src/core/Camera.js +++ b/src/core/Camera.js @@ -78,6 +78,8 @@ Phaser.Camera = function (game, id, x, y, width, height) { * @default */ this._edge = 0; + + this.displayObject = null; }; @@ -166,6 +168,8 @@ Phaser.Camera.prototype = { */ update: function () { + return; + // Add dirty flag if (this.target !== null) @@ -216,6 +220,8 @@ Phaser.Camera.prototype = { */ checkWorldBounds: function () { + return; + this.atLimit.x = false; this.atLimit.y = false; @@ -293,6 +299,7 @@ Object.defineProperty(Phaser.Camera.prototype, "x", { set: function (value) { this.view.x = value; + this.displayObject.x = -value; this.checkWorldBounds(); } @@ -311,6 +318,7 @@ Object.defineProperty(Phaser.Camera.prototype, "y", { set: function (value) { this.view.y = value; + this.displayObject.y = -value; this.checkWorldBounds(); } diff --git a/src/core/World.js b/src/core/World.js index 9f964afb..d3bb5978 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -54,12 +54,13 @@ Phaser.World.prototype = { */ boot: function () { + this.group = new Phaser.Group(this.game, null, '__world', false); + this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height); + this.camera.displayObject = this.group; this.game.camera = this.camera; - this.group = new Phaser.Group(this.game, null, '__world', true); - }, /** @@ -77,7 +78,7 @@ Phaser.World.prototype = { { var currentNode = this.game.stage._stage.first._iNext; - do + do { if (currentNode['preUpdate']) { diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index afd024a5..aef56b43 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -419,16 +419,16 @@ Phaser.Sprite.prototype.postUpdate = function() { if (this.exists) { // The sprite is positioned in this call, after taking into consideration motion updates and collision - this.body.postUpdate(); + // this.body.postUpdate(); - this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x); - this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y); + // this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x); + // this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y); - if (this.position.x != this._cache.x || this.position.y != this._cache.y) - { - this.position.x = this._cache.x; - this.position.y = this._cache.y; - } + // if (this.position.x != this._cache.x || this.position.y != this._cache.y) + // { + // this.position.x = this._cache.x; + // this.position.y = this._cache.y; + // } } } diff --git a/src/input/Keyboard.js b/src/input/Keyboard.js index 19bacb9e..c85e93ba 100644 --- a/src/input/Keyboard.js +++ b/src/input/Keyboard.js @@ -123,6 +123,23 @@ Phaser.Keyboard.prototype = { }, + /** + * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right. + * + * @method Phaser.Keyboard#createCursorKeys + * @return {object} An object containing properties: up, down, left and right. Which can be polled like any other Phaser.Key object. + */ + createCursorKeys: function () { + + return { + up: this.addKey(Phaser.Keyboard.UP), + down: this.addKey(Phaser.Keyboard.DOWN), + left: this.addKey(Phaser.Keyboard.LEFT), + right: this.addKey(Phaser.Keyboard.RIGHT) + } + + }, + /** * Starts the Keyboard event listeners running (keydown and keyup). They are attached to the document.body. * This is called automatically by Phaser.Input and should not normally be invoked directly. diff --git a/src/loader/Cache.js b/src/loader/Cache.js index 501d2057..436a1607 100644 --- a/src/loader/Cache.js +++ b/src/loader/Cache.js @@ -197,16 +197,14 @@ Phaser.Cache.prototype = { */ addDefaultImage: function () { - this._images['__default'] = { url: null, data: null, spriteSheet: false }; + var img = new Image(); + img.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg=="; + + this._images['__default'] = { url: null, data: img, spriteSheet: false }; this._images['__default'].frame = new Phaser.Frame(0, 0, 0, 32, 32, '', ''); - var base = new PIXI.BaseTexture(); - base.width = 32; - base.height = 32; - base.hasLoaded = true; // avoids a hanging event listener - - PIXI.BaseTextureCache['__default'] = base; - PIXI.TextureCache['__default'] = new PIXI.Texture(base); + PIXI.BaseTextureCache['__default'] = new PIXI.BaseTexture(img); + PIXI.TextureCache['__default'] = new PIXI.Texture(PIXI.BaseTextureCache['__default']); }, diff --git a/src/loader/Loader.js b/src/loader/Loader.js index adcf1d91..733d5f8b 100644 --- a/src/loader/Loader.js +++ b/src/loader/Loader.js @@ -733,7 +733,7 @@ Phaser.Loader.prototype = { this.onFileError.dispatch(key); - console.warn("Phaser.Loader error loading file: " + key); + console.warn("Phaser.Loader error loading file: " + key + ' from URL ' + this._fileList[key].url); this.nextFile(key, false);