Merge pull request #60 from TheJare/master

Fix bug in StateManager...
This commit is contained in:
Richard Davey
2013-09-22 14:32:25 -07:00
8 changed files with 61 additions and 54 deletions
+2 -1
View File
@@ -3,4 +3,5 @@
Phaser OSX.sublime-project
Phaser OSX.sublime-workspace
Phaser.sublime-project
Phaser.sublime-workspace
Phaser.sublime-workspace
node_modules
+6 -20
View File
@@ -1,7 +1,7 @@
/**
* Phaser - http://www.phaser.io
*
* v1.0.5 - Built at: Fri, 20 Sep 2013 12:59:22 +0000
* v1.0.5 - Built at: Fri, 20 Sep 2013 21:16:39 +0000
*
* @author Richard Davey http://www.photonstorm.com @photonstorm
*
@@ -7864,13 +7864,6 @@ Phaser.StateManager.prototype = {
{
// console.log('Loader queue empty');
this.game.loadComplete();
if (this.onCreateCallback)
{
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
}
else
{
@@ -7883,14 +7876,6 @@ Phaser.StateManager.prototype = {
{
// console.log('Preload callback not found');
// No init? Then there was nothing to load either
if (this.onCreateCallback)
{
// console.log('Create callback found');
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
this.game.loadComplete();
}
@@ -7988,9 +7973,9 @@ Phaser.StateManager.prototype = {
if (this._created == false && this.onCreateCallback)
{
// console.log('Create callback found');
this._created = true;
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
},
@@ -8061,6 +8046,7 @@ Phaser.StateManager.prototype = {
}
};
Phaser.LinkedList = function () {
this.next = null;
@@ -21681,12 +21667,12 @@ Phaser.Animation.FrameData.prototype = {
if (useNumericIndex)
{
// The actual frame
output.push(this.getFrame(input[i]));
output.push(this.getFrame(frames[i]));
}
else
{
// The actual frame
output.push(this.getFrameByName(input[i]));
output.push(this.getFrameByName(frames[i]));
}
}
}
@@ -21726,7 +21712,7 @@ Phaser.Animation.FrameData.prototype = {
// Does the frames array contain names or indexes?
if (useNumericIndex)
{
output.push(frames[i].index);
output.push(frames[i]);
}
else
{
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -2
View File
@@ -15,8 +15,8 @@ Phaser.Animation.Parser = {
* @method spriteSheet
* @param {Phaser.Game} game A reference to the currently running game.
* @param {String} key The Game.Cache asset key of the Sprite Sheet image.
* @param {Number} frameWidth The fixed width of each frame of the animation.
* @param {Number} frameHeight The fixed height of each frame of the animation.
* @param {Number} frameWidth The fixed width of each frame of the animation. If negative, indicates how many columns there are.
* @param {Number} frameHeight The fixed height of each frame of the animation. If negative, indicates how many rows there are.
* @param {Number} [frameMax=-1] The total number of animation frames to extact from the Sprite Sheet. The default value of -1 means "extract all frames".
* @return {Phaser.Animation.FrameData} A FrameData object containing the parsed frames.
*/
@@ -32,6 +32,14 @@ Phaser.Animation.Parser = {
var width = img.width;
var height = img.height;
if (frameWidth <= 0)
{
frameWidth = Math.floor(-width/Math.min(-1, frameWidth));
}
if (frameHeight <= 0)
{
frameHeight = Math.floor(-height/Math.min(-1, frameHeight));
}
var row = Math.round(width / frameWidth);
var column = Math.round(height / frameHeight);
var total = row * column;
+2 -17
View File
@@ -259,13 +259,6 @@ Phaser.StateManager.prototype = {
{
// console.log('Loader queue empty');
this.game.loadComplete();
if (this.onCreateCallback)
{
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
}
else
{
@@ -278,14 +271,6 @@ Phaser.StateManager.prototype = {
{
// console.log('Preload callback not found');
// No init? Then there was nothing to load either
if (this.onCreateCallback)
{
// console.log('Create callback found');
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
this.game.loadComplete();
}
@@ -383,9 +368,9 @@ Phaser.StateManager.prototype = {
if (this._created == false && this.onCreateCallback)
{
// console.log('Create callback found');
this._created = true;
this.onCreateCallback.call(this.callbackContext);
}
this._created = true;
},
@@ -455,4 +440,4 @@ Phaser.StateManager.prototype = {
}
};
};
+3
View File
@@ -80,6 +80,9 @@ Phaser.BitmapText.prototype.update = function() {
this._cache.dirty = true;
}
this.pivot.x = this.anchor.x*this.width;
this.pivot.y = this.anchor.y*this.height;
}
Object.defineProperty(Phaser.BitmapText.prototype, 'angle', {
+36 -12
View File
@@ -244,8 +244,8 @@ Phaser.Math = {
if (typeof radians === "undefined") { radians = true; }
var rd = (radians) ? GameMath.PI : 180;
return this.wrap(angle, rd, -rd);
var rd = (radians) ? Math.PI : 180;
return this.wrap(angle, -rd, rd);
},
@@ -257,7 +257,7 @@ Phaser.Math = {
if (typeof radians === "undefined") { radians = true; }
var rd = (radians) ? GameMath.PI : 180;
var rd = (radians) ? Math.PI : 180;
a1 = this.normalizeAngle(a1, radians);
a2 = this.normalizeAngle(a2, radians);
@@ -387,15 +387,39 @@ Phaser.Math = {
},
/**
* Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.
* <p>Values must be positive integers, and are passed through Math.abs</p>
*
* @param value The value to add the amount to
* @param amount The amount to add to the value
* @param max The maximum the value is allowed to be
* @return The wrapped value
*/
/**
* Ensures that the value always stays between min and max, by wrapping the value around.
* <p>max should be larger than min, or the function will return 0</p>
*
* @param value The value to wrap
* @param min The minimum the value is allowed to be
* @param max The maximum the value is allowed to be
* @return The wrapped value
*/
wrap: function (value, min, max) {
var range = max - min;
if (range <= 0)
{
return 0;
}
var result = (value - min) % range;
if (result < 0)
{
result += range;
}
return result + min;
},
/**
* Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.
* <p>Values must be positive integers, and are passed through Math.abs</p>
*
* @param value The value to add the amount to
* @param amount The amount to add to the value
* @param max The maximum the value is allowed to be
* @return The wrapped value
*/
wrapValue: function (value, amount, max) {
var diff;
+1 -1
View File
@@ -135,7 +135,7 @@ PIXI.BitmapText.prototype.updateText = function()
this.addChild(c);
}
this.width = pos.x * scale;
this.width = maxLineWidth * scale;
this.height = (pos.y + data.lineHeight) * scale;
};