Phaser 2.2.0 - Release Candidate 6.

This commit is contained in:
photonstorm 2014-11-14 08:16:55 +00:00
parent 527934d909
commit d8d2ebdb31
13 changed files with 587 additions and 191 deletions

View file

@ -145,6 +145,7 @@ The proxy methods are generated one-time dynamically but only when needed.
* Faster parent checks (if required)
* NO_SCALE should not not scale (vs previous behavior of having no behavior)
* Correct usage of scaleMode depending on mode
* Fullscreen Mode always scaling to fill screen in Firefox (#1256)
* AudioSprite - removed an unnecessary if-statement (thanks @DaanHaaz #1312)
* ArcadePhysics.skipQuadTree is now set to `true` by default. A QuadTree is a wonderful thing if the objects in your game are well spaced out. But in tightly packed games, especially those with tilemaps or single-screen games, they are a considerable performance drain and eat up CPU. We've taken the decision to disable the Arcade Physics QuadTree by default. It's all still in there and can be re-enabled via `game.physics.arcade.skipQuadTree = false`, but please only do so if you're sure your game benefits from this.
* Phaser.DOM now houses new DOM functions. Some have been moved over from ScaleManager as appropriate.

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11885,7 +11885,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11928,7 +11928,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,
@ -12002,11 +12002,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -20225,7 +20220,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !PIXI.scaleModes.LINEAR;
return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
},
@ -20233,11 +20228,11 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
if (value)
{
PIXI.scaleModes.LINEAR = 0;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR;
}
else
{
PIXI.scaleModes.LINEAR = 1;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
}
}
@ -25613,13 +25608,13 @@ Phaser.Game.prototype = {
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
'background: #7a66a3',
'background: #625186',
'color: #ffffff; background: #43375b;',
'background: #625186',
'background: #ccb9f2',
'background: #625186'
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #3db79f',
'background: #329582',
'color: #ffffff; background: #226558;',
'background: #329582',
'background: #3db79f',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
@ -27177,13 +27172,13 @@ Phaser.Key = function (game, keycode) {
this.event = null;
/**
* @property {boolean} isDown - The "down" state of the key.
* @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
* @default
*/
this.isDown = false;
/**
* @property {boolean} isUp - The "up" state of the key.
* @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
* @default
*/
this.isUp = true;
@ -27256,10 +27251,28 @@ Phaser.Key = function (game, keycode) {
*/
this.onUp = new Phaser.Signal();
/**
* @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justDown = false;
/**
* @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justUp = false;
};
Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#update
* @protected
*/
update: function () {
if (!this._enabled) { return; }
@ -27279,8 +27292,9 @@ Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyDown
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyDown: function (event) {
@ -27289,6 +27303,7 @@ Phaser.Key.prototype = {
this.event = event;
// exit if this key down is from auto-repeat
if (this.isDown)
{
return;
@ -27304,14 +27319,19 @@ Phaser.Key.prototype = {
this.duration = 0;
this.repeats = 0;
// _justDown will remain true until it is read via the justDown Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justDown = true;
this.onDown.dispatch(this);
},
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyUp
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyUp: function (event) {
@ -27330,6 +27350,10 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = this.game.time.time - this.timeDown;
// _justUp will remain true until it is read via the justUp Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justUp = true;
this.onUp.dispatch(this);
},
@ -27352,6 +27376,8 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = 0;
this._enabled = true; // .enabled causes reset(false)
this._justDown = false;
this._justUp = false;
if (hard)
{
@ -27364,12 +27390,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
* @method Phaser.Key#justPressed
* @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#downDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
* @return {boolean} True if the key was pressed down within the given duration.
*/
justPressed: function (duration) {
downDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27378,12 +27406,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
* @method Phaser.Key#justReleased
* @param {number} [duration=50] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#upDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
* @return {boolean} True if the key was released down within the given duration.
*/
justReleased: function (duration) {
upDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27393,9 +27423,54 @@ Phaser.Key.prototype = {
};
/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {
get: function () {
var current = this._justDown;
this._justDown = false;
return current;
}
});
/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {
get: function () {
var current = this._justUp;
this._justUp = false;
return current;
}
});
/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
*
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
@ -27403,9 +27478,13 @@ Phaser.Key.prototype = {
Object.defineProperty(Phaser.Key.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
value = !!value;
if (value !== this._enabled)
@ -27414,6 +27493,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
{
this.reset(false);
}
this._enabled = value;
}
}
@ -41833,7 +41913,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
*/
Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
{
var frameKey = '_on' + state + 'Frame';
if (frame != null) // not null or undefined

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:58
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11885,7 +11885,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11928,7 +11928,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,
@ -12002,11 +12002,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -20225,7 +20220,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !PIXI.scaleModes.LINEAR;
return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
},
@ -20233,11 +20228,11 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
if (value)
{
PIXI.scaleModes.LINEAR = 0;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR;
}
else
{
PIXI.scaleModes.LINEAR = 1;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
}
}
@ -25613,13 +25608,13 @@ Phaser.Game.prototype = {
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
'background: #7a66a3',
'background: #625186',
'color: #ffffff; background: #43375b;',
'background: #625186',
'background: #ccb9f2',
'background: #625186'
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #3db79f',
'background: #329582',
'color: #ffffff; background: #226558;',
'background: #329582',
'background: #3db79f',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
@ -27177,13 +27172,13 @@ Phaser.Key = function (game, keycode) {
this.event = null;
/**
* @property {boolean} isDown - The "down" state of the key.
* @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
* @default
*/
this.isDown = false;
/**
* @property {boolean} isUp - The "up" state of the key.
* @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
* @default
*/
this.isUp = true;
@ -27256,10 +27251,28 @@ Phaser.Key = function (game, keycode) {
*/
this.onUp = new Phaser.Signal();
/**
* @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justDown = false;
/**
* @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justUp = false;
};
Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#update
* @protected
*/
update: function () {
if (!this._enabled) { return; }
@ -27279,8 +27292,9 @@ Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyDown
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyDown: function (event) {
@ -27289,6 +27303,7 @@ Phaser.Key.prototype = {
this.event = event;
// exit if this key down is from auto-repeat
if (this.isDown)
{
return;
@ -27304,14 +27319,19 @@ Phaser.Key.prototype = {
this.duration = 0;
this.repeats = 0;
// _justDown will remain true until it is read via the justDown Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justDown = true;
this.onDown.dispatch(this);
},
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyUp
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyUp: function (event) {
@ -27330,6 +27350,10 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = this.game.time.time - this.timeDown;
// _justUp will remain true until it is read via the justUp Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justUp = true;
this.onUp.dispatch(this);
},
@ -27352,6 +27376,8 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = 0;
this._enabled = true; // .enabled causes reset(false)
this._justDown = false;
this._justUp = false;
if (hard)
{
@ -27364,12 +27390,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
* @method Phaser.Key#justPressed
* @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#downDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
* @return {boolean} True if the key was pressed down within the given duration.
*/
justPressed: function (duration) {
downDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27378,12 +27406,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
* @method Phaser.Key#justReleased
* @param {number} [duration=50] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#upDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
* @return {boolean} True if the key was released down within the given duration.
*/
justReleased: function (duration) {
upDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27393,9 +27423,54 @@ Phaser.Key.prototype = {
};
/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {
get: function () {
var current = this._justDown;
this._justDown = false;
return current;
}
});
/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {
get: function () {
var current = this._justUp;
this._justUp = false;
return current;
}
});
/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
*
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
@ -27403,9 +27478,13 @@ Phaser.Key.prototype = {
Object.defineProperty(Phaser.Key.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
value = !!value;
if (value !== this._enabled)
@ -27414,6 +27493,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
{
this.reset(false);
}
this._enabled = value;
}
}
@ -41833,7 +41913,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
*/
Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
{
var frameKey = '_on' + state + 'Frame';
if (frame != null) // not null or undefined

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -50,7 +50,7 @@
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,
@ -124,11 +124,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -8347,7 +8342,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !PIXI.scaleModes.LINEAR;
return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
},
@ -8355,11 +8350,11 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
if (value)
{
PIXI.scaleModes.LINEAR = 0;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR;
}
else
{
PIXI.scaleModes.LINEAR = 1;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
}
}
@ -13735,13 +13730,13 @@ Phaser.Game.prototype = {
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
'background: #7a66a3',
'background: #625186',
'color: #ffffff; background: #43375b;',
'background: #625186',
'background: #ccb9f2',
'background: #625186'
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #3db79f',
'background: #329582',
'color: #ffffff; background: #226558;',
'background: #329582',
'background: #3db79f',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
@ -15299,13 +15294,13 @@ Phaser.Key = function (game, keycode) {
this.event = null;
/**
* @property {boolean} isDown - The "down" state of the key.
* @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
* @default
*/
this.isDown = false;
/**
* @property {boolean} isUp - The "up" state of the key.
* @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
* @default
*/
this.isUp = true;
@ -15378,10 +15373,28 @@ Phaser.Key = function (game, keycode) {
*/
this.onUp = new Phaser.Signal();
/**
* @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justDown = false;
/**
* @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justUp = false;
};
Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#update
* @protected
*/
update: function () {
if (!this._enabled) { return; }
@ -15401,8 +15414,9 @@ Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyDown
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyDown: function (event) {
@ -15411,6 +15425,7 @@ Phaser.Key.prototype = {
this.event = event;
// exit if this key down is from auto-repeat
if (this.isDown)
{
return;
@ -15426,14 +15441,19 @@ Phaser.Key.prototype = {
this.duration = 0;
this.repeats = 0;
// _justDown will remain true until it is read via the justDown Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justDown = true;
this.onDown.dispatch(this);
},
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyUp
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyUp: function (event) {
@ -15452,6 +15472,10 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = this.game.time.time - this.timeDown;
// _justUp will remain true until it is read via the justUp Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justUp = true;
this.onUp.dispatch(this);
},
@ -15474,6 +15498,8 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = 0;
this._enabled = true; // .enabled causes reset(false)
this._justDown = false;
this._justUp = false;
if (hard)
{
@ -15486,12 +15512,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
* @method Phaser.Key#justPressed
* @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#downDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
* @return {boolean} True if the key was pressed down within the given duration.
*/
justPressed: function (duration) {
downDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -15500,12 +15528,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
* @method Phaser.Key#justReleased
* @param {number} [duration=50] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#upDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
* @return {boolean} True if the key was released down within the given duration.
*/
justReleased: function (duration) {
upDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -15515,9 +15545,54 @@ Phaser.Key.prototype = {
};
/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {
get: function () {
var current = this._justDown;
this._justDown = false;
return current;
}
});
/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {
get: function () {
var current = this._justUp;
this._justUp = false;
return current;
}
});
/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
*
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
@ -15525,9 +15600,13 @@ Phaser.Key.prototype = {
Object.defineProperty(Phaser.Key.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
value = !!value;
if (value !== this._enabled)
@ -15536,6 +15615,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
{
this.reset(false);
}
this._enabled = value;
}
}
@ -29955,7 +30035,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
*/
Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
{
var frameKey = '_on' + state + 'Frame';
if (frame != null) // not null or undefined

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:58
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11898,7 +11898,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,
@ -11972,11 +11972,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -20195,7 +20190,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !PIXI.scaleModes.LINEAR;
return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
},
@ -20203,11 +20198,11 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
if (value)
{
PIXI.scaleModes.LINEAR = 0;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR;
}
else
{
PIXI.scaleModes.LINEAR = 1;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
}
}
@ -25583,13 +25578,13 @@ Phaser.Game.prototype = {
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
'background: #7a66a3',
'background: #625186',
'color: #ffffff; background: #43375b;',
'background: #625186',
'background: #ccb9f2',
'background: #625186'
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #3db79f',
'background: #329582',
'color: #ffffff; background: #226558;',
'background: #329582',
'background: #3db79f',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
@ -27147,13 +27142,13 @@ Phaser.Key = function (game, keycode) {
this.event = null;
/**
* @property {boolean} isDown - The "down" state of the key.
* @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
* @default
*/
this.isDown = false;
/**
* @property {boolean} isUp - The "up" state of the key.
* @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
* @default
*/
this.isUp = true;
@ -27226,10 +27221,28 @@ Phaser.Key = function (game, keycode) {
*/
this.onUp = new Phaser.Signal();
/**
* @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justDown = false;
/**
* @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justUp = false;
};
Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#update
* @protected
*/
update: function () {
if (!this._enabled) { return; }
@ -27249,8 +27262,9 @@ Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyDown
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyDown: function (event) {
@ -27259,6 +27273,7 @@ Phaser.Key.prototype = {
this.event = event;
// exit if this key down is from auto-repeat
if (this.isDown)
{
return;
@ -27274,14 +27289,19 @@ Phaser.Key.prototype = {
this.duration = 0;
this.repeats = 0;
// _justDown will remain true until it is read via the justDown Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justDown = true;
this.onDown.dispatch(this);
},
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyUp
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyUp: function (event) {
@ -27300,6 +27320,10 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = this.game.time.time - this.timeDown;
// _justUp will remain true until it is read via the justUp Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justUp = true;
this.onUp.dispatch(this);
},
@ -27322,6 +27346,8 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = 0;
this._enabled = true; // .enabled causes reset(false)
this._justDown = false;
this._justUp = false;
if (hard)
{
@ -27334,12 +27360,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
* @method Phaser.Key#justPressed
* @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#downDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
* @return {boolean} True if the key was pressed down within the given duration.
*/
justPressed: function (duration) {
downDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27348,12 +27376,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
* @method Phaser.Key#justReleased
* @param {number} [duration=50] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#upDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
* @return {boolean} True if the key was released down within the given duration.
*/
justReleased: function (duration) {
upDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27363,9 +27393,54 @@ Phaser.Key.prototype = {
};
/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {
get: function () {
var current = this._justDown;
this._justDown = false;
return current;
}
});
/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {
get: function () {
var current = this._justUp;
this._justUp = false;
return current;
}
});
/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
*
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
@ -27373,9 +27448,13 @@ Phaser.Key.prototype = {
Object.defineProperty(Phaser.Key.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
value = !!value;
if (value !== this._enabled)
@ -27384,6 +27463,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
{
this.reset(false);
}
this._enabled = value;
}
}
@ -41803,7 +41883,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
*/
Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
{
var frameKey = '_on' + state + 'Frame';
if (frame != null) // not null or undefined

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,7 @@
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:43
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:58
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11885,7 +11885,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*
* Phaser - http://phaser.io
*
* v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
* v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
*
* By Richard Davey http://www.photonstorm.com @photonstorm
*
@ -11928,7 +11928,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,
@ -12002,11 +12002,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
// Equally we're going to supress the Pixi console log, with their agreement.
PIXI.dontSayHello = true;
// PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
// PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
// PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
// PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2014 Photon Storm Ltd.
@ -20225,7 +20220,7 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
get: function () {
return !PIXI.scaleModes.LINEAR;
return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
},
@ -20233,11 +20228,11 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
if (value)
{
PIXI.scaleModes.LINEAR = 0;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR;
}
else
{
PIXI.scaleModes.LINEAR = 1;
PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST;
}
}
@ -25613,13 +25608,13 @@ Phaser.Game.prototype = {
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
'background: #7a66a3',
'background: #625186',
'color: #ffffff; background: #43375b;',
'background: #625186',
'background: #ccb9f2',
'background: #625186'
'%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c\u2665%c\u2665%c\u2665',
'background: #3db79f',
'background: #329582',
'color: #ffffff; background: #226558;',
'background: #329582',
'background: #3db79f',
'background: #ffffff'
];
for (var i = 0; i < 3; i++)
@ -27177,13 +27172,13 @@ Phaser.Key = function (game, keycode) {
this.event = null;
/**
* @property {boolean} isDown - The "down" state of the key.
* @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
* @default
*/
this.isDown = false;
/**
* @property {boolean} isUp - The "up" state of the key.
* @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
* @default
*/
this.isUp = true;
@ -27256,10 +27251,28 @@ Phaser.Key = function (game, keycode) {
*/
this.onUp = new Phaser.Signal();
/**
* @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justDown = false;
/**
* @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
* @private
*/
this._justUp = false;
};
Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#update
* @protected
*/
update: function () {
if (!this._enabled) { return; }
@ -27279,8 +27292,9 @@ Phaser.Key.prototype = {
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyDown
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyDown: function (event) {
@ -27289,6 +27303,7 @@ Phaser.Key.prototype = {
this.event = event;
// exit if this key down is from auto-repeat
if (this.isDown)
{
return;
@ -27304,14 +27319,19 @@ Phaser.Key.prototype = {
this.duration = 0;
this.repeats = 0;
// _justDown will remain true until it is read via the justDown Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justDown = true;
this.onDown.dispatch(this);
},
/**
* Called automatically by Phaser.Keyboard.
*
* @method Phaser.Key#processKeyUp
* @param {KeyboardEvent} event.
* @param {KeyboardEvent} event - The DOM event that triggered this.
* @protected
*/
processKeyUp: function (event) {
@ -27330,6 +27350,10 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = this.game.time.time - this.timeDown;
// _justUp will remain true until it is read via the justUp Getter
// this enables the game to poll for past presses, or reset it at the start of a new game state
this._justUp = true;
this.onUp.dispatch(this);
},
@ -27352,6 +27376,8 @@ Phaser.Key.prototype = {
this.timeUp = this.game.time.time;
this.duration = 0;
this._enabled = true; // .enabled causes reset(false)
this._justDown = false;
this._justUp = false;
if (hard)
{
@ -27364,12 +27390,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
* @method Phaser.Key#justPressed
* @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
* @return {boolean} True if the key is just pressed otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#downDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
* @return {boolean} True if the key was pressed down within the given duration.
*/
justPressed: function (duration) {
downDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27378,12 +27406,14 @@ Phaser.Key.prototype = {
},
/**
* Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
* @method Phaser.Key#justReleased
* @param {number} [duration=50] - The duration below which the key is considered as being just released.
* @return {boolean} True if the key is just released otherwise false.
* Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
* or was pressed down longer ago than then given duration.
*
* @method Phaser.Key#upDuration
* @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
* @return {boolean} True if the key was released down within the given duration.
*/
justReleased: function (duration) {
upDuration: function (duration) {
if (typeof duration === "undefined") { duration = 50; }
@ -27393,9 +27423,54 @@ Phaser.Key.prototype = {
};
/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {
get: function () {
var current = this._justDown;
this._justDown = false;
return current;
}
});
/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {
get: function () {
var current = this._justUp;
this._justUp = false;
return current;
}
});
/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
*
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
@ -27403,9 +27478,13 @@ Phaser.Key.prototype = {
Object.defineProperty(Phaser.Key.prototype, "enabled", {
get: function () {
return this._enabled;
},
set: function (value) {
value = !!value;
if (value !== this._enabled)
@ -27414,6 +27493,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
{
this.reset(false);
}
this._enabled = value;
}
}
@ -41833,7 +41913,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
*/
Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
{
var frameKey = '_on' + state + 'Frame';
if (frame != null) // not null or undefined

File diff suppressed because one or more lines are too long

10
build/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -10,7 +10,7 @@
*/
var Phaser = Phaser || {
VERSION: '2.2.0-RC5',
VERSION: '2.2.0-RC6',
GAMES: [],
AUTO: 0,