77*
88* Phaser - http://phaser.io
99*
10- * v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
10+ * v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
1111*
1212* By Richard Davey http://www.photonstorm.com @photonstorm
1313*
@@ -11885,7 +11885,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
1188511885*
1188611886* Phaser - http://phaser.io
1188711887*
11888- * v2.2.0 "Bethal" - Built: Wed Nov 12 2014 22:48:42
11888+ * v2.2.0 "Bethal" - Built: Fri Nov 14 2014 08:15:57
1188911889*
1189011890* By Richard Davey http://www.photonstorm.com @photonstorm
1189111891*
@@ -11928,7 +11928,7 @@ PIXI.AbstractFilter.prototype.apply = function(frameBuffer)
1192811928*/
1192911929var Phaser = Phaser || {
1193011930
11931- VERSION: '2.2.0-RC5 ',
11931+ VERSION: '2.2.0-RC6 ',
1193211932 GAMES: [],
1193311933
1193411934 AUTO: 0,
@@ -12002,11 +12002,6 @@ PIXI.InteractionManager = PIXI.InteractionManager || function () {};
1200212002// Equally we're going to supress the Pixi console log, with their agreement.
1200312003PIXI.dontSayHello = true;
1200412004
12005- // PIXI.Polygon.prototype.type = PIXI.Graphics.POLY;
12006- // PIXI.Rectangle.prototype.type = PIXI.Graphics.RECT;
12007- // PIXI.Circle.prototype.type = PIXI.Graphics.CIRC;
12008- // PIXI.Ellipse.prototype.type = PIXI.Graphics.ELIP;
12009-
1201012005/**
1201112006* @author Richard Davey <rich@photonstorm.com>
1201212007* @copyright 2014 Photon Storm Ltd.
@@ -20225,19 +20220,19 @@ Object.defineProperty(Phaser.Stage.prototype, "smoothed", {
2022520220
2022620221 get: function () {
2022720222
20228- return ! PIXI.scaleModes.LINEAR;
20223+ return PIXI.scaleModes.DEFAULT === PIXI.scaleModes.LINEAR;
2022920224
2023020225 },
2023120226
2023220227 set: function (value) {
2023320228
2023420229 if (value)
2023520230 {
20236- PIXI.scaleModes.LINEAR = 0 ;
20231+ PIXI.scaleModes.DEFAULT = PIXI.scaleModes.LINEAR ;
2023720232 }
2023820233 else
2023920234 {
20240- PIXI.scaleModes.LINEAR = 1 ;
20235+ PIXI.scaleModes.DEFAULT = PIXI.scaleModes.NEAREST ;
2024120236 }
2024220237 }
2024320238
@@ -25613,13 +25608,13 @@ Phaser.Game.prototype = {
2561325608 if (this.device.chrome)
2561425609 {
2561525610 var args = [
25616- '%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + ' http://phaser.io %c %c \u2665%c\u2665%c\u2665 ',
25617- 'background: #7a66a3 ',
25618- 'background: #625186 ',
25619- 'color: #ffffff; background: #43375b ;',
25620- 'background: #625186 ',
25621- 'background: #ccb9f2 ',
25622- 'background: #625186 '
25611+ '%c %c %c Phaser v' + v + ' | Pixi.js ' + PIXI.VERSION + ' | ' + r + ' | ' + a + ' %c %c ' + '%c http://phaser.io %c \u2665%c\u2665%c\u2665',
25612+ 'background: #3db79f ',
25613+ 'background: #329582 ',
25614+ 'color: #ffffff; background: #226558 ;',
25615+ 'background: #329582 ',
25616+ 'background: #3db79f ',
25617+ 'background: #ffffff '
2562325618 ];
2562425619
2562525620 for (var i = 0; i < 3; i++)
@@ -27177,13 +27172,13 @@ Phaser.Key = function (game, keycode) {
2717727172 this.event = null;
2717827173
2717927174 /**
27180- * @property {boolean} isDown - The "down" state of the key.
27175+ * @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.
2718127176 * @default
2718227177 */
2718327178 this.isDown = false;
2718427179
2718527180 /**
27186- * @property {boolean} isUp - The "up" state of the key.
27181+ * @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
2718727182 * @default
2718827183 */
2718927184 this.isUp = true;
@@ -27256,10 +27251,28 @@ Phaser.Key = function (game, keycode) {
2725627251 */
2725727252 this.onUp = new Phaser.Signal();
2725827253
27254+ /**
27255+ * @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
27256+ * @private
27257+ */
27258+ this._justDown = false;
27259+
27260+ /**
27261+ * @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
27262+ * @private
27263+ */
27264+ this._justUp = false;
27265+
2725927266};
2726027267
2726127268Phaser.Key.prototype = {
2726227269
27270+ /**
27271+ * Called automatically by Phaser.Keyboard.
27272+ *
27273+ * @method Phaser.Key#update
27274+ * @protected
27275+ */
2726327276 update: function () {
2726427277
2726527278 if (!this._enabled) { return; }
@@ -27279,8 +27292,9 @@ Phaser.Key.prototype = {
2727927292
2728027293 /**
2728127294 * Called automatically by Phaser.Keyboard.
27295+ *
2728227296 * @method Phaser.Key#processKeyDown
27283- * @param {KeyboardEvent} event.
27297+ * @param {KeyboardEvent} event - The DOM event that triggered this .
2728427298 * @protected
2728527299 */
2728627300 processKeyDown: function (event) {
@@ -27289,6 +27303,7 @@ Phaser.Key.prototype = {
2728927303
2729027304 this.event = event;
2729127305
27306+ // exit if this key down is from auto-repeat
2729227307 if (this.isDown)
2729327308 {
2729427309 return;
@@ -27304,14 +27319,19 @@ Phaser.Key.prototype = {
2730427319 this.duration = 0;
2730527320 this.repeats = 0;
2730627321
27322+ // _justDown will remain true until it is read via the justDown Getter
27323+ // this enables the game to poll for past presses, or reset it at the start of a new game state
27324+ this._justDown = true;
27325+
2730727326 this.onDown.dispatch(this);
2730827327
2730927328 },
2731027329
2731127330 /**
2731227331 * Called automatically by Phaser.Keyboard.
27332+ *
2731327333 * @method Phaser.Key#processKeyUp
27314- * @param {KeyboardEvent} event.
27334+ * @param {KeyboardEvent} event - The DOM event that triggered this .
2731527335 * @protected
2731627336 */
2731727337 processKeyUp: function (event) {
@@ -27330,6 +27350,10 @@ Phaser.Key.prototype = {
2733027350 this.timeUp = this.game.time.time;
2733127351 this.duration = this.game.time.time - this.timeDown;
2733227352
27353+ // _justUp will remain true until it is read via the justUp Getter
27354+ // this enables the game to poll for past presses, or reset it at the start of a new game state
27355+ this._justUp = true;
27356+
2733327357 this.onUp.dispatch(this);
2733427358
2733527359 },
@@ -27352,6 +27376,8 @@ Phaser.Key.prototype = {
2735227376 this.timeUp = this.game.time.time;
2735327377 this.duration = 0;
2735427378 this._enabled = true; // .enabled causes reset(false)
27379+ this._justDown = false;
27380+ this._justUp = false;
2735527381
2735627382 if (hard)
2735727383 {
@@ -27364,12 +27390,14 @@ Phaser.Key.prototype = {
2736427390 },
2736527391
2736627392 /**
27367- * Returns the "just pressed" state of the Key. Just pressed is considered true if the key was pressed down within the duration given.
27368- * @method Phaser.Key#justPressed
27369- * @param {number} [duration=50] - The duration below which the key is considered as being just pressed.
27370- * @return {boolean} True if the key is just pressed otherwise false.
27393+ * Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
27394+ * or was pressed down longer ago than then given duration.
27395+ *
27396+ * @method Phaser.Key#downDuration
27397+ * @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
27398+ * @return {boolean} True if the key was pressed down within the given duration.
2737127399 */
27372- justPressed : function (duration) {
27400+ downDuration : function (duration) {
2737327401
2737427402 if (typeof duration === "undefined") { duration = 50; }
2737527403
@@ -27378,12 +27406,14 @@ Phaser.Key.prototype = {
2737827406 },
2737927407
2738027408 /**
27381- * Returns the "just released" state of the Key. Just released is considered as being true if the key was released within the duration given.
27382- * @method Phaser.Key#justReleased
27383- * @param {number} [duration=50] - The duration below which the key is considered as being just released.
27384- * @return {boolean} True if the key is just released otherwise false.
27409+ * Returns `true` if the Key was pressed down within the `duration` value given, or `false` is it either isn't down,
27410+ * or was pressed down longer ago than then given duration.
27411+ *
27412+ * @method Phaser.Key#upDuration
27413+ * @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
27414+ * @return {boolean} True if the key was released down within the given duration.
2738527415 */
27386- justReleased : function (duration) {
27416+ upDuration : function (duration) {
2738727417
2738827418 if (typeof duration === "undefined") { duration = 50; }
2738927419
@@ -27393,19 +27423,68 @@ Phaser.Key.prototype = {
2739327423
2739427424};
2739527425
27426+ /**
27427+ * The justDown value allows you to test if this Key has just been pressed down or not.
27428+ * When you check this value it will return `true` if the Key is down, otherwise `false`.
27429+ * You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
27430+ * 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.
27431+ *
27432+ * @property {boolean} justDown
27433+ * @memberof Phaser.Key
27434+ * @default false
27435+ */
27436+ Object.defineProperty(Phaser.Key.prototype, "justDown", {
27437+
27438+ get: function () {
27439+
27440+ var current = this._justDown;
27441+ this._justDown = false;
27442+ return current;
27443+
27444+ }
27445+
27446+ });
27447+
27448+ /**
27449+ * The justUp value allows you to test if this Key has just been released or not.
27450+ * When you check this value it will return `true` if the Key is up, otherwise `false`.
27451+ * You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
27452+ * 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.
27453+ *
27454+ * @property {boolean} justUp
27455+ * @memberof Phaser.Key
27456+ * @default false
27457+ */
27458+ Object.defineProperty(Phaser.Key.prototype, "justUp", {
27459+
27460+ get: function () {
27461+
27462+ var current = this._justUp;
27463+ this._justUp = false;
27464+ return current;
27465+
27466+ }
27467+
27468+ });
27469+
2739627470/**
2739727471* An enabled key processes its update and dispatches events.
2739827472* A key can be disabled momentarily at runtime instead of deleting it.
27473+ *
2739927474* @property {boolean} enabled
2740027475* @memberof Phaser.Key
2740127476* @default true
2740227477*/
2740327478Object.defineProperty(Phaser.Key.prototype, "enabled", {
2740427479
2740527480 get: function () {
27481+
2740627482 return this._enabled;
27483+
2740727484 },
27485+
2740827486 set: function (value) {
27487+
2740927488 value = !!value;
2741027489
2741127490 if (value !== this._enabled)
@@ -27414,6 +27493,7 @@ Object.defineProperty(Phaser.Key.prototype, "enabled", {
2741427493 {
2741527494 this.reset(false);
2741627495 }
27496+
2741727497 this._enabled = value;
2741827498 }
2741927499 }
@@ -41833,7 +41913,6 @@ Phaser.Button.prototype.removedFromWorld = function () {
4183341913*/
4183441914Phaser.Button.prototype.setStateFrame = function (state, frame, switchImmediately)
4183541915{
41836-
4183741916 var frameKey = '_on' + state + 'Frame';
4183841917
4183941918 if (frame != null) // not null or undefined
0 commit comments