From 42c0bed502561e630dcf3a5247a9551bf8e75c8f Mon Sep 17 00:00:00 2001 From: photonstorm Date: Tue, 3 Dec 2013 02:13:57 +0000 Subject: [PATCH] Fixed World.scale and Group.scale. --- README.md | 4 +++- examples/groups/bring a child to top.js | 6 ----- examples/groups/bring a group to top.js | 1 - src/PixiPatch.js | 4 ++-- src/core/Group.js | 7 ++++-- src/core/World.js | 6 +---- src/gameobjects/Sprite.js | 2 -- src/input/InputHandler.js | 32 ------------------------- src/loader/Cache.js | 2 +- src/net/Net.js | 4 ++-- src/pixi/textures/Texture.js | 3 ++- 11 files changed, 16 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 1d6d0275..fb26e70f 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,9 @@ Updates: Bug Fixes: -* TBC +* Cache.getImageKeys returned __missing in the array, now excluded. +* Fixed Group.scale so you can now scale a Group directly. +* Removed World.scale as it was preventing Group.scale from working - you can still scale the world, but you'll need to factor in Input changes yourself. You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md diff --git a/examples/groups/bring a child to top.js b/examples/groups/bring a child to top.js index 425524ba..de80a920 100644 --- a/examples/groups/bring a child to top.js +++ b/examples/groups/bring a child to top.js @@ -2,12 +2,6 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: function preload() { - // Enable scaling - game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; - game.stage.scale.maxWidth = 1024; - game.stage.scale.maxHeight = 672; - game.stage.scale.refresh(); - game.load.image('atari1', 'assets/sprites/atari130xe.png'); game.load.image('atari2', 'assets/sprites/atari800xl.png'); game.load.image('atari4', 'assets/sprites/atari800.png'); diff --git a/examples/groups/bring a group to top.js b/examples/groups/bring a group to top.js index 2a67bf2b..2365053c 100644 --- a/examples/groups/bring a group to top.js +++ b/examples/groups/bring a group to top.js @@ -31,7 +31,6 @@ function create() { // Now let's create some random sprites and enable them all for drag and 'bring to top' for (var i = 0; i < 10; i++) { - var tempSprite = game.add.sprite(game.stage.randomX, game.stage.randomY, 'atari1'); tempSprite.name = 'atari' + i; diff --git a/src/PixiPatch.js b/src/PixiPatch.js index 23cd92d2..282dee22 100644 --- a/src/PixiPatch.js +++ b/src/PixiPatch.js @@ -79,8 +79,8 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject) displayObject.texture.frame.y, displayObject.texture.frame.width, displayObject.texture.frame.height, - (displayObject.anchor.x) * -displayObject.texture.frame.width, - (displayObject.anchor.y) * -displayObject.texture.frame.height, + Math.floor((displayObject.anchor.x) * -displayObject.texture.frame.width), + Math.floor((displayObject.anchor.y) * -displayObject.texture.frame.height), displayObject.texture.frame.width, displayObject.texture.frame.height); } diff --git a/src/core/Group.js b/src/core/Group.js index d7bed67c..71b5f8fa 100644 --- a/src/core/Group.js +++ b/src/core/Group.js @@ -77,10 +77,13 @@ Phaser.Group = function (game, parent, name, useStage) { */ this.exists = true; + // Replaces the PIXI.Point with a slightly more flexible one. + this._container.scale = new Phaser.Point(1, 1); + /** - * @property {Phaser.Point} scale - Replaces the PIXI.Point with a slightly more flexible one. + * @property {Phaser.Point} scale - The scane of the Group container. */ - this.scale = new Phaser.Point(1, 1); + this.scale = this._container.scale; /** * The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions. diff --git a/src/core/World.js b/src/core/World.js index 9ecd1cd9..9eadf09e 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -12,6 +12,7 @@ * the world at world-based coordinates. By default a world is created the same size as your Stage. * * @class Phaser.World +* @extends Phaser.Group * @constructor * @param {Phaser.Game} game - Reference to the current game instance. */ @@ -19,11 +20,6 @@ Phaser.World = function (game) { Phaser.Group.call(this, game, null, '__world', false); - /** - * @property {Phaser.Point} scale - Replaces the PIXI.Point with a slightly more flexible one. - */ - this.scale = new Phaser.Point(1, 1); - /** * The World has no fixed size, but it does have a bounds outside of which objects are no longer considered as being "in world" and you should use this to clean-up the display list and purge dead objects. * By default we set the Bounds to be from 0,0 to Game.width,Game.height. I.e. it will match the size given to the game constructor with 0,0 representing the top-left of the display. diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index be7ab1e9..71cdd228 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -1101,8 +1101,6 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { set: function (value) { - console.log('inputEnabled', value, this.input); - if (value) { if (this.input.enabled === false) diff --git a/src/input/InputHandler.js b/src/input/InputHandler.js index 9bd137ed..01c04ca2 100644 --- a/src/input/InputHandler.js +++ b/src/input/InputHandler.js @@ -28,36 +28,6 @@ Phaser.InputHandler = function (sprite) { */ this.enabled = false; - /** - * @property {Description} parent - Description. - * @default - */ - // this.parent = null; - - /** - * @property {Description} next - Linked List - * @default - */ - // this.next = null; - - /** - * @property {Description} prev - Description. - * @default - */ - // this.prev = null; - - /** - * @property {Description} last - Description. - * @default - */ - // this.last = this; - - /** - * @property {Description} first - Description. - * @default - */ - // this.first = this; - /** * @property {number} priorityID - The PriorityID controls which Sprite receives an Input event first if they should overlap. * @default @@ -199,8 +169,6 @@ Phaser.InputHandler.prototype = { */ start: function (priority, useHandCursor) { - console.log('InputHandler start'); - priority = priority || 0; if (typeof useHandCursor == 'undefined') { useHandCursor = false; } diff --git a/src/loader/Cache.js b/src/loader/Cache.js index ab380a3c..40ce6d0a 100644 --- a/src/loader/Cache.js +++ b/src/loader/Cache.js @@ -745,7 +745,7 @@ Phaser.Cache.prototype = { for (var item in array) { - if (item !== '__default') + if (item !== '__default' && item !== '__missing') { output.push(item); } diff --git a/src/net/Net.js b/src/net/Net.js index b41fb5b6..cb412371 100644 --- a/src/net/Net.js +++ b/src/net/Net.js @@ -128,8 +128,8 @@ Phaser.Net.prototype = { var output = {}; var keyValues = location.search.substring(1).split('&'); - for (var i in keyValues) { - + for (var i in keyValues) + { var key = keyValues[i].split('='); if (key.length > 1) diff --git a/src/pixi/textures/Texture.js b/src/pixi/textures/Texture.js index 11d82a0b..6ac48717 100644 --- a/src/pixi/textures/Texture.js +++ b/src/pixi/textures/Texture.js @@ -115,7 +115,8 @@ PIXI.Texture.prototype.setFrame = function(frame) if(frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height) { - throw new Error("Texture Error: frame does not fit inside the base Texture dimensions " + this); + console.log(frame); + throw new Error("Texture Error: frame does not fit inside the base Texture dimensions ", frame); } this.updateFrame = true;