From 7a259da22c3fe98082159bf4a79f03b3d4a7b6d3 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 19:51:54 +0100 Subject: [PATCH 01/72] Updated BaseSoundManager play method to return value from sound play method call --- src/sound/BaseSoundManager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index ab36167fd..ae9037b35 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -167,6 +167,7 @@ var BaseSoundManager = new Class({ * @method Phaser.Sound.BaseSoundManager#play * @param {string} key - Asset key for the sound. * @param {ISoundConfig | ISoundMarker} [extra] - An optional additional object containing settings to be applied to the sound. It could be either config or marker object. + * @returns {boolean} Whether the sound started playing successfully. */ play: function (key, extra) { var sound = this.add(key); @@ -175,14 +176,14 @@ var BaseSoundManager = new Class({ if (extra) { if (extra.name) { sound.addMarker(extra); - sound.play(extra.name); + return sound.play(extra.name); } else { - sound.play(extra); + return sound.play(extra); } } else { - sound.play(); + return sound.play(); } }, /** From db5002fa8787af1540b7920276104f24d08b4e5c Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 19:53:09 +0100 Subject: [PATCH 02/72] Updated BaseSoundManager playAudioSprite method to return value from sound play method call --- src/sound/BaseSoundManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index ae9037b35..c2ea7c459 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -194,11 +194,12 @@ var BaseSoundManager = new Class({ * @param {string} key - Asset key for the sound. * @param {string} spriteName - The name of the sound sprite to play. * @param {ISoundConfig} [config] - An optional config object containing default sound settings. + * @returns {boolean} Whether the audio sprite sound started playing successfully. */ playAudioSprite: function (key, spriteName, config) { var sound = this.addAudioSprite(key); sound.once('ended', sound.destroy, sound); - sound.play(spriteName, config); + return sound.play(spriteName, config); }, /** * Removes a sound from the sound manager. From 4316c22785e98f70229dc3a407e6294c0abaaab1 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 19:57:00 +0100 Subject: [PATCH 03/72] Added NoAudioSoundManager class that extends EventEmitter --- src/sound/noaudio/NoAudioSoundManager.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/sound/noaudio/NoAudioSoundManager.js diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js new file mode 100644 index 000000000..9c6fa6784 --- /dev/null +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -0,0 +1,9 @@ +var Class = require('../../utils/Class'); +var EventEmitter = require('eventemitter3'); +var NoAudioSoundManager = new Class({ + Extends: EventEmitter, + initialize: function NoAudioSoundManager(game) { + EventEmitter.call(this); + } +}); +module.exports = NoAudioSoundManager; From e15a5a9c696033abd12c4dc081d438b0d500a912 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 19:59:19 +0100 Subject: [PATCH 04/72] Initializing game property with provided attribute reference --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 9c6fa6784..0a9cb5621 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -4,6 +4,7 @@ var NoAudioSoundManager = new Class({ Extends: EventEmitter, initialize: function NoAudioSoundManager(game) { EventEmitter.call(this); + this.game = game; } }); module.exports = NoAudioSoundManager; From c5062a0c90588ee82607e681f22c7210082963ec Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 19:59:54 +0100 Subject: [PATCH 05/72] Initializing sounds property an empty array --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 0a9cb5621..574266482 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -5,6 +5,7 @@ var NoAudioSoundManager = new Class({ initialize: function NoAudioSoundManager(game) { EventEmitter.call(this); this.game = game; + this.sounds = []; } }); module.exports = NoAudioSoundManager; From 1c6aa693e979555f1feeeea715292bfd4b1d979c Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:00:21 +0100 Subject: [PATCH 06/72] Initializing mute property to false --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 574266482..a0931331e 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -6,6 +6,7 @@ var NoAudioSoundManager = new Class({ EventEmitter.call(this); this.game = game; this.sounds = []; + this.mute = false; } }); module.exports = NoAudioSoundManager; From ee8ce19ef8068304f40b0a6b96ef14ef7c2b703a Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:00:36 +0100 Subject: [PATCH 07/72] Initializing volume property to 1 --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index a0931331e..a8e4cc1f4 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -7,6 +7,7 @@ var NoAudioSoundManager = new Class({ this.game = game; this.sounds = []; this.mute = false; + this.volume = 1; } }); module.exports = NoAudioSoundManager; From 526fe77106669e87e1e5e4fa2446b68333afa476 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:00:55 +0100 Subject: [PATCH 08/72] Initializing rate property to 1 --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index a8e4cc1f4..c70e85c16 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -8,6 +8,7 @@ var NoAudioSoundManager = new Class({ this.sounds = []; this.mute = false; this.volume = 1; + this.rate = 1; } }); module.exports = NoAudioSoundManager; From 27b2936ce687fa5ef6e888afc75a85e6a06d918f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:01:09 +0100 Subject: [PATCH 09/72] Initializing rate property to 0 --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index c70e85c16..e30e8a846 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -9,6 +9,7 @@ var NoAudioSoundManager = new Class({ this.mute = false; this.volume = 1; this.rate = 1; + this.detune = 0; } }); module.exports = NoAudioSoundManager; From fdcc4898cca507cf6fc61996c80c67d5113c3ec8 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:01:26 +0100 Subject: [PATCH 10/72] Initializing pauseOnBlur property to true --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index e30e8a846..829a6fe34 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -10,6 +10,7 @@ var NoAudioSoundManager = new Class({ this.volume = 1; this.rate = 1; this.detune = 0; + this.pauseOnBlur = true; } }); module.exports = NoAudioSoundManager; From a1fa271d7cea912f3b195f191eef8292f7515e6e Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:01:44 +0100 Subject: [PATCH 11/72] Initializing locked property to false --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 829a6fe34..ff9fab91c 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -11,6 +11,7 @@ var NoAudioSoundManager = new Class({ this.rate = 1; this.detune = 0; this.pauseOnBlur = true; + this.locked = false; } }); module.exports = NoAudioSoundManager; From f1aea49a9c9111aa892ffc86897a8d1f9bf55857 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:01:55 +0100 Subject: [PATCH 12/72] Initializing unlocked property to false --- src/sound/noaudio/NoAudioSoundManager.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index ff9fab91c..624e75154 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -12,6 +12,7 @@ var NoAudioSoundManager = new Class({ this.detune = 0; this.pauseOnBlur = true; this.locked = false; + this.unlocked = false; } }); module.exports = NoAudioSoundManager; From 7511c038b7baa24dd56e2667f743c63904f8bb0e Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:10:16 +0100 Subject: [PATCH 13/72] Added add method which instantiates and returns NoAudioSound object --- src/sound/noaudio/NoAudioSoundManager.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 624e75154..2e14e8350 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -1,5 +1,6 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); +var NoAudioSound = require('./NoAudioSound'); var NoAudioSoundManager = new Class({ Extends: EventEmitter, initialize: function NoAudioSoundManager(game) { @@ -13,6 +14,11 @@ var NoAudioSoundManager = new Class({ this.pauseOnBlur = true; this.locked = false; this.unlocked = false; + }, + add: function (key, config) { + var sound = new NoAudioSound(this, key, config); + this.sounds.push(sound); + return sound; } }); module.exports = NoAudioSoundManager; From cd00b5db79e48be9e4efb4f1f902cf78a5f8777f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:11:48 +0100 Subject: [PATCH 14/72] Added addAudioSprite method which instantiates and returns NoAudioSound as audio sprite sound object with empty spritemap --- src/sound/noaudio/NoAudioSoundManager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 2e14e8350..d875e801d 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -19,6 +19,11 @@ var NoAudioSoundManager = new Class({ var sound = new NoAudioSound(this, key, config); this.sounds.push(sound); return sound; + }, + addAudioSprite: function (key, config) { + var sound = this.add(key, config); + sound.spritemap = {}; + return sound; } }); module.exports = NoAudioSoundManager; From 4a4a849c6f5636e168396316a54f48731ea4eda6 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:12:36 +0100 Subject: [PATCH 15/72] Added play method which only returns false --- src/sound/noaudio/NoAudioSoundManager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index d875e801d..ade049afb 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -24,6 +24,9 @@ var NoAudioSoundManager = new Class({ var sound = this.add(key, config); sound.spritemap = {}; return sound; - } + }, + play: function (key, extra) { + return false; + }, }); module.exports = NoAudioSoundManager; From 5ba2c0338a50095e0888644de149d443fc79a019 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:13:14 +0100 Subject: [PATCH 16/72] Added playAudioSprite method which only returns false --- src/sound/noaudio/NoAudioSoundManager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index ade049afb..a29eebaf0 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -28,5 +28,8 @@ var NoAudioSoundManager = new Class({ play: function (key, extra) { return false; }, + playAudioSprite: function (key, spriteName, config) { + return false; + } }); module.exports = NoAudioSoundManager; From 2b0765f46a321af6064413710f5e967b139d2c0a Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:23:33 +0100 Subject: [PATCH 17/72] Added remove method that calls BaseSoundManager remove method --- src/sound/noaudio/NoAudioSoundManager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index a29eebaf0..7b32ada6b 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -1,6 +1,7 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); var NoAudioSound = require('./NoAudioSound'); +var BaseSoundManager = require('../BaseSoundManager'); var NoAudioSoundManager = new Class({ Extends: EventEmitter, initialize: function NoAudioSoundManager(game) { @@ -30,6 +31,9 @@ var NoAudioSoundManager = new Class({ }, playAudioSprite: function (key, spriteName, config) { return false; + }, + remove: function (sound) { + return BaseSoundManager.prototype.remove.call(this, sound); } }); module.exports = NoAudioSoundManager; From 50fefeef2e5662e90947375eb38d15e0dc652cd3 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:24:10 +0100 Subject: [PATCH 18/72] Added removeByKey method that calls BaseSoundManager removeByKey method --- src/sound/noaudio/NoAudioSoundManager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 7b32ada6b..0fc90d9d4 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -34,6 +34,9 @@ var NoAudioSoundManager = new Class({ }, remove: function (sound) { return BaseSoundManager.prototype.remove.call(this, sound); + }, + removeByKey: function (key) { + return BaseSoundManager.prototype.removeByKey.call(this, key); } }); module.exports = NoAudioSoundManager; From 534a7a34cdad76d53e76997fb517466c6773eb84 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:24:46 +0100 Subject: [PATCH 19/72] Added pauseAll method that does nothing --- src/sound/noaudio/NoAudioSoundManager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 0fc90d9d4..4c684855a 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -2,6 +2,7 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); var NoAudioSound = require('./NoAudioSound'); var BaseSoundManager = require('../BaseSoundManager'); +var NOOP = require('../../utils/NOOP'); var NoAudioSoundManager = new Class({ Extends: EventEmitter, initialize: function NoAudioSoundManager(game) { @@ -37,6 +38,7 @@ var NoAudioSoundManager = new Class({ }, removeByKey: function (key) { return BaseSoundManager.prototype.removeByKey.call(this, key); - } + }, + pauseAll: NOOP }); module.exports = NoAudioSoundManager; From 05d37e00c75f0e71b3592c2096596c3d14454c79 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:25:03 +0100 Subject: [PATCH 20/72] Added resumeAll method that does nothing --- src/sound/noaudio/NoAudioSoundManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 4c684855a..7a8ad5924 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -39,6 +39,7 @@ var NoAudioSoundManager = new Class({ removeByKey: function (key) { return BaseSoundManager.prototype.removeByKey.call(this, key); }, - pauseAll: NOOP + pauseAll: NOOP, + resumeAll: NOOP }); module.exports = NoAudioSoundManager; From e9c1ba289e80cf27e667086b24287fa8237388e7 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:25:27 +0100 Subject: [PATCH 21/72] Added stopAll method that does nothing --- src/sound/noaudio/NoAudioSoundManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 7a8ad5924..308560ca6 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -40,6 +40,7 @@ var NoAudioSoundManager = new Class({ return BaseSoundManager.prototype.removeByKey.call(this, key); }, pauseAll: NOOP, - resumeAll: NOOP + resumeAll: NOOP, + stopAll: NOOP }); module.exports = NoAudioSoundManager; From 8ee02f8f2994daf8449e0b448a29c5087d17cc2f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:31:53 +0100 Subject: [PATCH 22/72] Added update method that does nothing --- src/sound/noaudio/NoAudioSoundManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 308560ca6..94fdf852c 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -41,6 +41,7 @@ var NoAudioSoundManager = new Class({ }, pauseAll: NOOP, resumeAll: NOOP, - stopAll: NOOP + stopAll: NOOP, + update: NOOP }); module.exports = NoAudioSoundManager; From ce5de6e06a6ec0ce2c6f5b010972ed0e8b5da045 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:32:15 +0100 Subject: [PATCH 23/72] Added destroy method that calls BaseSoundManager destroy method --- src/sound/noaudio/NoAudioSoundManager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 94fdf852c..a81cdbcc0 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -42,6 +42,9 @@ var NoAudioSoundManager = new Class({ pauseAll: NOOP, resumeAll: NOOP, stopAll: NOOP, - update: NOOP + update: NOOP, + destroy: function () { + BaseSoundManager.prototype.destroy.call(this); + } }); module.exports = NoAudioSoundManager; From 1dc28e1119fb99a15ac1937b3d6e0dbfb36db799 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:32:30 +0100 Subject: [PATCH 24/72] Added forEachActiveSound method that calls BaseSoundManager forEachActiveSound method --- src/sound/noaudio/NoAudioSoundManager.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index a81cdbcc0..0f290087c 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -45,6 +45,9 @@ var NoAudioSoundManager = new Class({ update: NOOP, destroy: function () { BaseSoundManager.prototype.destroy.call(this); + }, + forEachActiveSound: function (callbackfn, thisArg) { + BaseSoundManager.prototype.forEachActiveSound.call(this, callbackfn, thisArg); } }); module.exports = NoAudioSoundManager; From 732cb5592a4b271931ec7fab90e3abbe8f7969e4 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:35:34 +0100 Subject: [PATCH 25/72] Removed setting unlocked property --- src/sound/noaudio/NoAudioSoundManager.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSoundManager.js b/src/sound/noaudio/NoAudioSoundManager.js index 0f290087c..0532b2a09 100644 --- a/src/sound/noaudio/NoAudioSoundManager.js +++ b/src/sound/noaudio/NoAudioSoundManager.js @@ -15,7 +15,6 @@ var NoAudioSoundManager = new Class({ this.detune = 0; this.pauseOnBlur = true; this.locked = false; - this.unlocked = false; }, add: function (key, config) { var sound = new NoAudioSound(this, key, config); From 4c2b7b3db7b27a8eb54682d021e81ee63fe3754a Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:56:49 +0100 Subject: [PATCH 26/72] Added NoAudioSound class that extends EventEmitter --- src/sound/noaudio/NoAudioSound.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/sound/noaudio/NoAudioSound.js diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js new file mode 100644 index 000000000..1c4047a85 --- /dev/null +++ b/src/sound/noaudio/NoAudioSound.js @@ -0,0 +1,9 @@ +var Class = require('../../utils/Class'); +var EventEmitter = require('eventemitter3'); +var NoAudioSound = new Class({ + Extends: EventEmitter, + initialize: function NoAudioSound(manager, key, config) { + EventEmitter.call(this); + } +}); +module.exports = NoAudioSound; From 10daa22fb0919807f89ba2cd5bf37948abf98a41 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:58:02 +0100 Subject: [PATCH 27/72] Initializing manager property with provided attribute reference --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 1c4047a85..dc3cbc892 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -4,6 +4,7 @@ var NoAudioSound = new Class({ Extends: EventEmitter, initialize: function NoAudioSound(manager, key, config) { EventEmitter.call(this); + this.manager = manager; } }); module.exports = NoAudioSound; From d282f3a1cbe9d3a4875ad30b46025ecf803fe26c Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:58:31 +0100 Subject: [PATCH 28/72] Initializing key property with provided attribute value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index dc3cbc892..6bee9bc49 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -5,6 +5,7 @@ var NoAudioSound = new Class({ initialize: function NoAudioSound(manager, key, config) { EventEmitter.call(this); this.manager = manager; + this.key = key; } }); module.exports = NoAudioSound; From 0de3b321d2b7df7ecf1f8365e990aa0840496dd5 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:59:13 +0100 Subject: [PATCH 29/72] Initializing isPlaying property to false --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 6bee9bc49..aa367865c 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -6,6 +6,7 @@ var NoAudioSound = new Class({ EventEmitter.call(this); this.manager = manager; this.key = key; + this.isPlaying = false; } }); module.exports = NoAudioSound; From a2a19cceb238a605c3f3fac82e74461dacd4f1a7 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 20:59:27 +0100 Subject: [PATCH 30/72] Initializing isPaused property to false --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index aa367865c..f7e63218a 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -7,6 +7,7 @@ var NoAudioSound = new Class({ this.manager = manager; this.key = key; this.isPlaying = false; + this.isPaused = false; } }); module.exports = NoAudioSound; From d2a3d98abe9951cd65bed6706a8e64fd6e7bd44f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:00:31 +0100 Subject: [PATCH 31/72] Initializing totalRate property to 1 --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index f7e63218a..b591169ef 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -8,6 +8,7 @@ var NoAudioSound = new Class({ this.key = key; this.isPlaying = false; this.isPaused = false; + this.totalRate = 1; } }); module.exports = NoAudioSound; From 65696b17a5ba3a7d37aee512984b82ad496bb400 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:00:50 +0100 Subject: [PATCH 32/72] Initializing duration property to 0 --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index b591169ef..a8e23d0d9 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -9,6 +9,7 @@ var NoAudioSound = new Class({ this.isPlaying = false; this.isPaused = false; this.totalRate = 1; + this.duration = 0; } }); module.exports = NoAudioSound; From f925d3f5bde4046e6fd1955a5f41517caf4671bd Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:01:04 +0100 Subject: [PATCH 33/72] Initializing totalDuration property to 0 --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index a8e23d0d9..77b2abf0d 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -10,6 +10,7 @@ var NoAudioSound = new Class({ this.isPaused = false; this.totalRate = 1; this.duration = 0; + this.totalDuration = 0; } }); module.exports = NoAudioSound; From ff6f7f844cbe4015e406e9986008b658093bed68 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:07:00 +0100 Subject: [PATCH 34/72] Initializing config property to object with default config values merged with provided config attribute --- src/sound/noaudio/NoAudioSound.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 77b2abf0d..ef29257ff 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -1,5 +1,6 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); +var Extend = require('../utils/object/Extend'); var NoAudioSound = new Class({ Extends: EventEmitter, initialize: function NoAudioSound(manager, key, config) { @@ -11,6 +12,15 @@ var NoAudioSound = new Class({ this.totalRate = 1; this.duration = 0; this.totalDuration = 0; + this.config = Extend({ + mute: false, + volume: 1, + rate: 1, + detune: 0, + seek: 0, + loop: false, + delay: 0 + }, config); } }); module.exports = NoAudioSound; From cd070ac2825072d19c7f280b3e35a571afcdcd9d Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:07:30 +0100 Subject: [PATCH 35/72] Initializing currentConfig property to point to config property --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index ef29257ff..91699937c 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -21,6 +21,7 @@ var NoAudioSound = new Class({ loop: false, delay: 0 }, config); + this.currentConfig = this.config; } }); module.exports = NoAudioSound; From 5f58588903277da82b7e9fa734b1f9024c5666bd Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:07:54 +0100 Subject: [PATCH 36/72] Initializing mute property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 91699937c..74af93586 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -22,6 +22,7 @@ var NoAudioSound = new Class({ delay: 0 }, config); this.currentConfig = this.config; + this.mute = false; } }); module.exports = NoAudioSound; From e6477b0e40a0ce171592ee4be0ba04580b6712a4 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:08:08 +0100 Subject: [PATCH 37/72] Initializing volume property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 74af93586..9957d5dd3 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -23,6 +23,7 @@ var NoAudioSound = new Class({ }, config); this.currentConfig = this.config; this.mute = false; + this.volume = 1; } }); module.exports = NoAudioSound; From fc46d8d4d0953891b194fec502069f4243ec3839 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:08:21 +0100 Subject: [PATCH 38/72] Initializing rate property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 9957d5dd3..8b799c01f 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -24,6 +24,7 @@ var NoAudioSound = new Class({ this.currentConfig = this.config; this.mute = false; this.volume = 1; + this.rate = 1; } }); module.exports = NoAudioSound; From 858d296a1c9f38d7ee49a7b29f76290ad4f137ff Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:08:34 +0100 Subject: [PATCH 39/72] Initializing detune property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 8b799c01f..2fff20b1c 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -25,6 +25,7 @@ var NoAudioSound = new Class({ this.mute = false; this.volume = 1; this.rate = 1; + this.detune = 0; } }); module.exports = NoAudioSound; From 1fa851b0e872c32455493c5f2670706e131c14d0 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:08:47 +0100 Subject: [PATCH 40/72] Initializing seek property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 2fff20b1c..f328c49c3 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -26,6 +26,7 @@ var NoAudioSound = new Class({ this.volume = 1; this.rate = 1; this.detune = 0; + this.seek = 0; } }); module.exports = NoAudioSound; From cde2b9c080a05a95b719c72e4bdcf8ec457c034f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:09:08 +0100 Subject: [PATCH 41/72] Initializing loop property to default value --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index f328c49c3..832cd5609 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -27,6 +27,7 @@ var NoAudioSound = new Class({ this.rate = 1; this.detune = 0; this.seek = 0; + this.loop = false; } }); module.exports = NoAudioSound; From 6a207de3b0bd84677ee7b421f75e38f1926e0607 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:09:28 +0100 Subject: [PATCH 42/72] Initializing markers property to an empty object --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 832cd5609..734cdc809 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -28,6 +28,7 @@ var NoAudioSound = new Class({ this.detune = 0; this.seek = 0; this.loop = false; + this.markers = {}; } }); module.exports = NoAudioSound; From e76377a89e41dad0a17bbea4dc9c22de036a6dea Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:09:46 +0100 Subject: [PATCH 43/72] Initializing currentMarker property to null --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 734cdc809..a80967e97 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -29,6 +29,7 @@ var NoAudioSound = new Class({ this.seek = 0; this.loop = false; this.markers = {}; + this.currentMarker = null; } }); module.exports = NoAudioSound; From 063dda1929e94446291eae25d7ede8403ee8500a Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:10:00 +0100 Subject: [PATCH 44/72] Initializing pendingRemove property to false --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index a80967e97..bf314c1d8 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -30,6 +30,7 @@ var NoAudioSound = new Class({ this.loop = false; this.markers = {}; this.currentMarker = null; + this.pendingRemove = false; } }); module.exports = NoAudioSound; From e9c441b98ab10694879b4385517f5ed06a402dc8 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:10:51 +0100 Subject: [PATCH 45/72] Added addMarker method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index bf314c1d8..278f56e7a 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -31,6 +31,9 @@ var NoAudioSound = new Class({ this.markers = {}; this.currentMarker = null; this.pendingRemove = false; + }, + addMarker: function (marker) { + return false; } }); module.exports = NoAudioSound; From 8685b7c2acde838d45b40e7e6d9242ae6a833275 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:11:16 +0100 Subject: [PATCH 46/72] Added updateMarker method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 278f56e7a..d29bcbfec 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -34,6 +34,9 @@ var NoAudioSound = new Class({ }, addMarker: function (marker) { return false; + }, + updateMarker: function (marker) { + return false; } }); module.exports = NoAudioSound; From dcc406d218c7c2d8a8b333ba4336f2eff35f032f Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:11:35 +0100 Subject: [PATCH 47/72] Added removeMarker method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index d29bcbfec..4fd9ce8fc 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -37,6 +37,9 @@ var NoAudioSound = new Class({ }, updateMarker: function (marker) { return false; + }, + removeMarker: function (markerName) { + return null; } }); module.exports = NoAudioSound; From f8cefe6606d69c674e119fb399329967c1177230 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:11:53 +0100 Subject: [PATCH 48/72] Added play method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 4fd9ce8fc..d6ad3df13 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -40,6 +40,9 @@ var NoAudioSound = new Class({ }, removeMarker: function (markerName) { return null; + }, + play: function (markerName, config) { + return false; } }); module.exports = NoAudioSound; From a52145eb9e25f1e6c8b9a57fdfd4046c81590f5e Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:12:18 +0100 Subject: [PATCH 49/72] Added pause method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index d6ad3df13..11c99d9ab 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -43,6 +43,9 @@ var NoAudioSound = new Class({ }, play: function (markerName, config) { return false; + }, + pause: function () { + return false; } }); module.exports = NoAudioSound; From c071d8db16e98d2121122b1773a99a5278ad0f2e Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:12:36 +0100 Subject: [PATCH 50/72] Added resume method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 11c99d9ab..d8c99564b 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -46,6 +46,9 @@ var NoAudioSound = new Class({ }, pause: function () { return false; + }, + resume: function () { + return false; } }); module.exports = NoAudioSound; From eda3a080b431bc6a7cdde3818696df6d0bdb2970 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:12:53 +0100 Subject: [PATCH 51/72] Added stop method that only returns false --- src/sound/noaudio/NoAudioSound.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index d8c99564b..ba7f2ab85 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -49,6 +49,9 @@ var NoAudioSound = new Class({ }, resume: function () { return false; + }, + stop: function () { + return false; } }); module.exports = NoAudioSound; From 59801806598e4979769b1273e7bd412b76d0a3ce Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:13:36 +0100 Subject: [PATCH 52/72] Added update method that does nothing --- src/sound/noaudio/NoAudioSound.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index ba7f2ab85..0e831460a 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -1,6 +1,7 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); var Extend = require('../utils/object/Extend'); +var NOOP = require('../../utils/NOOP'); var NoAudioSound = new Class({ Extends: EventEmitter, initialize: function NoAudioSound(manager, key, config) { @@ -52,6 +53,7 @@ var NoAudioSound = new Class({ }, stop: function () { return false; - } + }, + update: NOOP }); module.exports = NoAudioSound; From 2bf8358d3e0a4d5206dea59f5052568e1993480b Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:14:15 +0100 Subject: [PATCH 53/72] Added destroy method that calls BaseSound destroy method --- src/sound/noaudio/NoAudioSound.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 0e831460a..56e47dfa7 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -2,6 +2,7 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); var Extend = require('../utils/object/Extend'); var NOOP = require('../../utils/NOOP'); +var BaseSound = require('../BaseSound'); var NoAudioSound = new Class({ Extends: EventEmitter, initialize: function NoAudioSound(manager, key, config) { @@ -54,6 +55,9 @@ var NoAudioSound = new Class({ stop: function () { return false; }, - update: NOOP + update: NOOP, + destroy: function () { + BaseSound.prototype.destroy.call(this); + } }); module.exports = NoAudioSound; From 7ecc671781a33d20c2286dece3683e346b7a6905 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:18:01 +0100 Subject: [PATCH 54/72] Removed update method --- src/sound/noaudio/NoAudioSound.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 56e47dfa7..c30bbcc21 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -55,7 +55,6 @@ var NoAudioSound = new Class({ stop: function () { return false; }, - update: NOOP, destroy: function () { BaseSound.prototype.destroy.call(this); } From b42a426cc9f8a6b16870c923eb88325b8299a5b1 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:18:42 +0100 Subject: [PATCH 55/72] Removeing sound from manager before calling BaseSound destroy method --- src/sound/noaudio/NoAudioSound.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index c30bbcc21..2df6a1395 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -56,6 +56,7 @@ var NoAudioSound = new Class({ return false; }, destroy: function () { + this.manager.remove(this); BaseSound.prototype.destroy.call(this); } }); From e03108e33272171166148b72eaeed92204350d80 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:19:43 +0100 Subject: [PATCH 56/72] Removed unused NOOP import --- src/sound/noaudio/NoAudioSound.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index 2df6a1395..b4095e6a3 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -1,7 +1,6 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); var Extend = require('../utils/object/Extend'); -var NOOP = require('../../utils/NOOP'); var BaseSound = require('../BaseSound'); var NoAudioSound = new Class({ Extends: EventEmitter, From 87fa583c4754dc672e1822b2b63673bcbfbed782 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:23:43 +0100 Subject: [PATCH 57/72] Competed a TODO to instantiate NoAudioSoundManager if there is no audio engine available or sounds are disabled in config --- src/sound/SoundManagerCreator.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sound/SoundManagerCreator.js b/src/sound/SoundManagerCreator.js index 7e055d5df..44d55bd14 100644 --- a/src/sound/SoundManagerCreator.js +++ b/src/sound/SoundManagerCreator.js @@ -1,6 +1,6 @@ -var BaseSoundManager = require('./BaseSoundManager'); var WebAudioSoundManager = require('./webaudio/WebAudioSoundManager'); var HTML5AudioSoundManager = require('./html5/HTML5AudioSoundManager'); +var NoAudioSoundManager = require('./noaudio/NoAudioSoundManager'); var SoundManagerCreator = { @@ -11,8 +11,7 @@ var SoundManagerCreator = { if ((audioConfig && audioConfig.noAudio) || (!deviceAudio.webAudio && !deviceAudio.audioData)) { - // TODO add no audio implementation of BaseSoundManager - return new BaseSoundManager(game); + return new NoAudioSoundManager(game); } if(deviceAudio.webAudio && !(audioConfig && audioConfig.disableWebAudio)) From 18cf394f8acfd0a13a9d52730525819bfa6d2db0 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 21:28:37 +0100 Subject: [PATCH 58/72] Fixed path to Extend import --- src/sound/noaudio/NoAudioSound.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/noaudio/NoAudioSound.js b/src/sound/noaudio/NoAudioSound.js index b4095e6a3..9b20f0a60 100644 --- a/src/sound/noaudio/NoAudioSound.js +++ b/src/sound/noaudio/NoAudioSound.js @@ -1,6 +1,6 @@ var Class = require('../../utils/Class'); var EventEmitter = require('eventemitter3'); -var Extend = require('../utils/object/Extend'); +var Extend = require('../../utils/object/Extend'); var BaseSound = require('../BaseSound'); var NoAudioSound = new Class({ Extends: EventEmitter, From 472a0d9a4f226dc286344490140a256d4ab2beb2 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sat, 20 Jan 2018 22:06:36 +0100 Subject: [PATCH 59/72] Added no audio classes to index.js --- src/sound/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sound/index.js b/src/sound/index.js index 1bd8f2d1a..f15f79577 100644 --- a/src/sound/index.js +++ b/src/sound/index.js @@ -11,6 +11,9 @@ module.exports = { WebAudioSoundManager: require('./webaudio/WebAudioSoundManager'), HTML5AudioSound: require('./html5/HTML5AudioSound'), - HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager') + HTML5AudioSoundManager: require('./html5/HTML5AudioSoundManager'), + + NoAudioSound: require('./noaudio/NoAudioSound'), + NoAudioSoundManager: require('./noaudio/NoAudioSoundManager') }; From 7f7eab6c9c7707925fa51a1389349c1f59692eff Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 14:04:28 +0100 Subject: [PATCH 60/72] Eslint config fixes --- .eslintrc.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 866b253dd..3df3a43cf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -46,7 +46,7 @@ "indent": [ "error", 4, { "SwitchCase": 1 } ], "key-spacing": [ "error", { "beforeColon": false, "afterColon": true }], "linebreak-style": [ "off" ], - "lines-around-comment": [ "error", { "beforeBlockComment": true, "afterBlockComment": false, "beforeLineComment": true, "afterLineComment": false, "allowBlockStart": true, "allowBlockEnd": false, "allowObjectStart": true, "allowArrayStart": true, "allowBlockEnd": true }], + "lines-around-comment": [ "error", { "beforeBlockComment": true, "afterBlockComment": false, "beforeLineComment": true, "afterLineComment": false, "allowBlockStart": true, "allowBlockEnd": false, "allowObjectStart": true, "allowArrayStart": true }], "new-parens": "error", "no-array-constructor": "error", "no-lonely-if": "error", @@ -66,7 +66,7 @@ "space-in-parens": [ "error", "never" ], "space-infix-ops": [ "error", { "int32Hint": true } ], "wrap-regex": "error", - "spaced-comment": [ "error", "always", { "block": { "balanced": true }} ] + "spaced-comment": [ "error", "always", { "block": { "balanced": true, "exceptions": ["*", "!"] }} ] } -} \ No newline at end of file +} From 4160d738bc44cb0a58d80cb02544683ccdad3769 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:10:08 +0100 Subject: [PATCH 61/72] Passing loader reference to load method --- src/loader/filetypes/HTML5AudioFile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 12c45cea4..68ba51f90 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -59,9 +59,9 @@ var HTML5AudioFile = new Class({ }, // Called by the Loader, starts the actual file downloading - load: function (callback, baseURL) + load: function (loader) { - this.callback = callback; + this.loader = loader; this.data = []; @@ -90,7 +90,7 @@ var HTML5AudioFile = new Class({ for (i = 0; i < this.data.length; i++) { audio = this.data[i]; - audio.src = GetURL(this, baseURL || ''); + audio.src = GetURL(this, loader.baseURL); if (!this.locked) { From e1c5969bd49966f7f318c4e5d6610ff45c320051 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:11:30 +0100 Subject: [PATCH 62/72] Calling loader nextFile method instead of callback --- src/loader/filetypes/HTML5AudioFile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 68ba51f90..ae6f31abc 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -29,7 +29,7 @@ var HTML5AudioFile = new Class({ onLoad: function () { - this.callback(this, true); + this.loader.nextFile(this, true); }, onError: function (event) From d743ac82c1e6b9b3316f987e90f1d9e4bd1a6135 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:12:34 +0100 Subject: [PATCH 63/72] Added loaded flag to prevent multiple calls to onLoad method --- src/loader/filetypes/HTML5AudioFile.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index ae6f31abc..09f0175c4 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -15,6 +15,8 @@ var HTML5AudioFile = new Class({ { this.locked = locked; + this.loaded = false; + var fileConfig = { type: 'audio', extension: GetFastValue(url, 'type', ''), @@ -29,6 +31,13 @@ var HTML5AudioFile = new Class({ onLoad: function () { + if(this.loaded) + { + return; + } + + this.loaded = true; + this.loader.nextFile(this, true); }, From bdf38448ea3ae6dcf194dc0dc35382c47afb6d6a Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:13:02 +0100 Subject: [PATCH 64/72] Calling loader nextFile method instead of callback --- src/loader/filetypes/HTML5AudioFile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 09f0175c4..c5c0d24df 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -50,7 +50,7 @@ var HTML5AudioFile = new Class({ audio.onerror = null; } - this.callback(this, false); + this.loader.nextFile(this, false); }, onProgress: function (event) From f917c94d93967521d5d1dabbc7653c4f83fe9b96 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:13:48 +0100 Subject: [PATCH 65/72] Emitting fileprogress event --- src/loader/filetypes/HTML5AudioFile.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index c5c0d24df..70535247b 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -59,12 +59,16 @@ var HTML5AudioFile = new Class({ audio.oncanplaythrough = null; audio.onerror = null; - if(++this.filesLoaded === this.filesTotal) + this.filesLoaded++; + + this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); + + this.loader.emit('fileprogress', this, this.percentComplete); + + if(this.filesLoaded === this.filesTotal) { this.onLoad(); } - - this.percentComplete = Math.min((this.filesLoaded / this.filesTotal), 1); }, // Called by the Loader, starts the actual file downloading From c604fd9a5e0dd6a65231f643e63efc01e3dcc204 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Sun, 21 Jan 2018 15:14:46 +0100 Subject: [PATCH 66/72] Removed updating loading properties if audio is locked --- src/loader/filetypes/HTML5AudioFile.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 70535247b..dbee29f7b 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -113,13 +113,7 @@ var HTML5AudioFile = new Class({ if (this.locked) { - setTimeout(function () - { - this.filesLoaded = this.filesTotal; - this.percentComplete = 1; - this.onLoad(); - - }.bind(this)); + setTimeout(this.onLoad.bind(this)); } } From 348da8c81ee999816e1169bbd257bf82c7d9fd0f Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Sun, 21 Jan 2018 12:53:27 -0600 Subject: [PATCH 67/72] MatterTileBody: wrapper around a Tile that provides access to a matter body --- src/gameobjects/tilemap/Tile.js | 6 + src/physics/matter-js/MatterTileBody.js | 188 ++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 src/physics/matter-js/MatterTileBody.js diff --git a/src/gameobjects/tilemap/Tile.js b/src/gameobjects/tilemap/Tile.js index c8572302f..4078e2f15 100644 --- a/src/gameobjects/tilemap/Tile.js +++ b/src/gameobjects/tilemap/Tile.js @@ -182,6 +182,12 @@ var Tile = new Class({ * @default */ this.tint = 0xffffff; + + /** + * An empty object where physics-engine specific information (e.g. bodies) may be stored. + * @property {object} physics + */ + this.physics = {}; }, /** diff --git a/src/physics/matter-js/MatterTileBody.js b/src/physics/matter-js/MatterTileBody.js new file mode 100644 index 000000000..ae9360edb --- /dev/null +++ b/src/physics/matter-js/MatterTileBody.js @@ -0,0 +1,188 @@ +var AnimationComponent = require('../../gameobjects/components/Animation'); +var Bodies = require('./lib/factory/Bodies'); +var Class = require('../../utils/Class'); +var Components = require('./components'); +var GetFastValue = require('../../utils/object/GetFastValue'); +var HasValue = require('../../utils/object/HasValue'); +var Extend = require('../../utils/object/Extend'); +var Body = require('./lib/body/Body'); +var Vertices = require('./lib/geometry/Vertices'); + +var MatterTileBody = new Class({ + + Mixins: [ + Components.Bounce, + Components.Collision, + Components.Friction, + Components.Gravity, + Components.Mass, + Components.Sensor, + Components.Sleep, + Components.Static + ], + + initialize: + + function MatterTileBody (world, tile, options) + { + this.tile = tile; + this.world = world; + + // A tile is only allowed one matter body + if (tile.physics.matterBody) + { + tile.physics.matterBody.destroy(); + } + tile.physics.matterBody = this; + + // Set the body either from an existing body (if provided), the shapes in the tileset + // collision layer (if it exists) or a rectangle matching the tile. + var body = GetFastValue(options, 'body', null); + var addToWorld = GetFastValue(options, 'addToWorld', true); + if (!body) + { + var tileset = tile.layer.tilemapLayer.tileset; + var collisionGroup = tileset.getTileCollisionGroup(tile.index); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + if (collisionObjects.length > 0) + { + this.setFromTileCollision(options); + } + else + { + this.setFromTileRectangle(options); + } + } + else + { + this.setBody(body, addToWorld); + } + }, + + setFromTileRectangle: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, "isStatic")) { options.isStatic = true; } + if (!HasValue(options, "addToWorld")) { options.addToWorld = true; } + + var tile = this.tile; + var tilemapLayer = tile.layer.tilemapLayer; + var tileset = tilemapLayer.tileset; + var w = tile.width * tilemapLayer.scaleX; + var h = tile.height * tilemapLayer.scaleY; + var x = tilemapLayer.tileToWorldX(tile.x); + var y = tilemapLayer.tileToWorldY(tile.y); + var body = Bodies.rectangle(x + (w / 2), y + (h / 2), w, h, options); + this.setBody(body, options.addToWorld); + + return this; + }, + + setFromTileCollision: function (options) + { + if (options === undefined) { options = {}; } + if (!HasValue(options, "isStatic")) { options.isStatic = true; } + if (!HasValue(options, "addToWorld")) { options.addToWorld = true; } + + var tile = this.tile; + var tilemapLayer = tile.layer.tilemapLayer; + var tileset = tilemapLayer.tileset; + var w = tile.width * tilemapLayer.scaleX; + var h = tile.height * tilemapLayer.scaleY; + var x = tilemapLayer.tileToWorldX(tile.x); + var y = tilemapLayer.tileToWorldY(tile.y); + + var collisionGroup = tileset.getTileCollisionGroup(tile.index); + var collisionObjects = GetFastValue(collisionGroup, 'objects', []); + + var parts = []; + for (var i = 0; i < collisionObjects.length; i++) + { + var object = collisionObjects[i]; + var ox = x + object.x; + var oy = y + object.y; + var ow = object.width; + var oh = object.height; + var body = null; + + if (object.rectangle) + { + body = Bodies.rectangle(ox + ow / 2, oy + oh / 2, ow, oh, options); + } + else if (object.ellipse) + { + body = Bodies.circle(ox + ow / 2, oy + oh / 2, ow / 2, options); + } + else if (object.polygon || object.polyline) + { + // Polygons and polylines are both treated as closed polygons. Concave shapes are + // supported if poly-decomp library is included, but it's best to manually create + // convex polygons. + var originalPoints = object.polygon ? object.polygon : object.polyline; + var points = originalPoints.map(function (p) { + return { x: p[0], y: p[1] }; + }); + var vertices = Vertices.create(points); + + // Translate from object position to center of mass + var center = Vertices.centre(vertices); + body = Bodies.fromVertices(ox + center.x, oy + center.y, vertices, options); + } + + if (body) + { + parts.push(body); + } + } + + if (parts.length === 1) + { + this.setBody(parts[0], options.addToWorld); + } + else if (parts.length > 1) + { + options.parts = parts; + this.setBody(Body.create(options), options.addToWorld); + } + + return this; + }, + + setBody: function (body, addToWorld) + { + if (addToWorld === undefined) { addToWorld = true; } + + if (this.body) + { + this.removeBody(); + } + + this.body = body; + this.body.gameObject = this; + + if (addToWorld) + { + this.world.add(this.body); + } + + return this; + }, + + removeBody: function () + { + if (this.body) + { + this.world.remove(this.body); + this.body.gameObject = undefined; + this.body = undefined; + } + }, + + destroy: function () + { + this.removeBody(); + tile.physics.matterBody = undefined; + } +}); + +module.exports = MatterTileBody; From ccdad43920f90e984f240785c21726b21077a6d3 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Sun, 21 Jan 2018 12:53:48 -0600 Subject: [PATCH 68/72] Matter world and factory methods for creating a tile body --- src/physics/matter-js/Factory.js | 12 +++++++++-- src/physics/matter-js/World.js | 36 +++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/physics/matter-js/Factory.js b/src/physics/matter-js/Factory.js index 8965ac131..fa72e04ca 100644 --- a/src/physics/matter-js/Factory.js +++ b/src/physics/matter-js/Factory.js @@ -5,11 +5,12 @@ var Constraint = require('./lib/constraint/Constraint'); var MatterImage = require('./MatterImage'); var MatterSprite = require('./MatterSprite'); var PointerConstraint = require('./PointerConstraint'); +var MatterTileBody = require('./MatterTileBody'); // When registering a factory function 'this' refers to the GameObjectFactory context. -// +// // There are several properties available to use: -// +// // this.scene - a reference to the Scene that owns the GameObjectFactory // this.displayList - a reference to the Display List the Scene owns // this.updateList - a reference to the Update List the Scene owns @@ -219,6 +220,13 @@ var Factory = new Class({ return image; }, + tileBody: function (tile, options) + { + var tileBody = new MatterTileBody(this.world, tile, options); + + return tileBody; + }, + sprite: function (x, y, key, frame, options) { var sprite = new MatterSprite(this.world, x, y, key, frame, options); diff --git a/src/physics/matter-js/World.js b/src/physics/matter-js/World.js index 09d241bfb..ab9a3271a 100644 --- a/src/physics/matter-js/World.js +++ b/src/physics/matter-js/World.js @@ -10,6 +10,7 @@ var GetValue = require('../../utils/object/GetValue'); var MatterBody = require('./lib/body/Body'); var MatterEvents = require('./lib/core/Events'); var MatterWorld = require('./lib/body/World'); +var MatterTileBody = require('./MatterTileBody'); var World = new Class({ @@ -38,7 +39,7 @@ var World = new Class({ * @property {object} walls - An object containing the 4 wall bodies that bound the physics world. */ this.walls = { left: null, right: null, top: null, bottom: null }; - + if (GetFastValue(config, 'setBounds', false)) { var boundsConfig = config['setBounds']; @@ -283,6 +284,39 @@ var World = new Class({ return this; }, + /** + * All colliding tiles will be set + */ + convertTilemapLayer: function (tilemapLayer, options) + { + var layerData = tilemapLayer.layer; + var tiles = tilemapLayer.getTilesWithin(0, 0, layerData.width, layerData.height, { + isColliding: true + }); + + this.convertTiles(tiles, options); + + return this; + }, + + /** + * Array of tiles + */ + convertTiles: function (tiles, options) + { + if (tiles.length === 0) + { + return this; + } + + for (var i = 0; i < tiles.length; i++) + { + new MatterTileBody(this, tiles[i], options); + } + + return this; + }, + nextGroup: function (isNonColliding) { return MatterBody.nextGroup(isNonColliding); From 568b04cedbff07108c7555ebff4b6b3f01ece5a6 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Sun, 21 Jan 2018 15:28:04 -0600 Subject: [PATCH 69/72] Loader typo in new loader structure --- src/loader/filetypes/TilemapJSONFile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/loader/filetypes/TilemapJSONFile.js b/src/loader/filetypes/TilemapJSONFile.js index 90d7d2392..1e23b3ec7 100644 --- a/src/loader/filetypes/TilemapJSONFile.js +++ b/src/loader/filetypes/TilemapJSONFile.js @@ -17,9 +17,9 @@ var TilemapJSONFile = function (key, url, path, format, xhrSettings) }; // When registering a factory function 'this' refers to the Loader context. -// +// // There are several properties available to use: -// +// // this.scene - a reference to the Scene that owns the GameObjectFactory FileTypesManager.register('tilemapTiledJSON', function (key, url, xhrSettings) @@ -48,12 +48,12 @@ FileTypesManager.register('tilemapWeltmeister', function (key, url, xhrSettings) for (var i = 0; i < key.length; i++) { // If it's an array it has to be an array of Objects, so we get everything out of the 'key' object - this.addFile(TilemapJSONFile(key[i], url, this.path, TILEMAP_FORMATS.WELTMEISTER.TILED_JSON, xhrSettings)); + this.addFile(TilemapJSONFile(key[i], url, this.path, TILEMAP_FORMATS.WELTMEISTER, xhrSettings)); } } else { - this.addFile(TilemapJSONFile(key, url, this.path, TILEMAP_FORMATS.WELTMEISTER.TILED_JSON, xhrSettings)); + this.addFile(TilemapJSONFile(key, url, this.path, TILEMAP_FORMATS.WELTMEISTER, xhrSettings)); } // For method chaining From eb3c9fe34193ea906a90368df31f55f63429cba5 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 22 Jan 2018 12:04:14 +0000 Subject: [PATCH 70/72] Fix for the read-only DOMRect issue flagged in #3176 --- src/input/InputManager.js | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/input/InputManager.js b/src/input/InputManager.js index a03eef659..c92f92fc2 100644 --- a/src/input/InputManager.js +++ b/src/input/InputManager.js @@ -1,14 +1,15 @@ -// Phaser.Input.InputManager - var Class = require('../utils/Class'); var EventEmitter = require('eventemitter3'); var Gamepad = require('./gamepad/GamepadManager'); var Keyboard = require('./keyboard/KeyboardManager'); var Mouse = require('./mouse/MouseManager'); var Pointer = require('./Pointer'); +var Rectangle = require('../geom/rectangle/Rectangle'); var Touch = require('./touch/TouchManager'); var TransformXY = require('../math/TransformXY'); +// Phaser.Input.InputManager + var InputManager = new Class({ initialize: @@ -46,7 +47,7 @@ var InputManager = new Class({ this.ignoreEvents = false; - this.bounds; + this.bounds = new Rectangle(); this._tempPoint = { x: 0, y: 0 }; this._tempHitTest = []; @@ -72,22 +73,16 @@ var InputManager = new Class({ updateBounds: function () { - var bounds = this.canvas.getBoundingClientRect(); + var clientRect = this.canvas.getBoundingClientRect(); + var bounds = this.bounds; - if (window.scrollX) - { - bounds.left += window.scrollX; - } - - if (window.scrollY) - { - bounds.top += window.scrollY; - } - - this.bounds = bounds; + bounds.left = clientRect.left + window.pageXOffset; + bounds.top = clientRect.top + window.pageYOffset; + bounds.width = clientRect.width; + bounds.height = clientRect.height; }, - update: function (time, delta) + update: function (time) { this.keyboard.update(); this.gamepad.update(); From 75e9349b3cae78e4d3dab611bb9c89433645a609 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 22 Jan 2018 12:21:42 +0000 Subject: [PATCH 71/72] Text canvas width cannot drop below 1x1 pixels. --- src/gameobjects/text/static/Text.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gameobjects/text/static/Text.js b/src/gameobjects/text/static/Text.js index bf94ed152..e8cbece09 100644 --- a/src/gameobjects/text/static/Text.js +++ b/src/gameobjects/text/static/Text.js @@ -576,6 +576,9 @@ var Text = new Class({ w *= this.resolution; h *= this.resolution; + w = Math.max(w, 1); + h = Math.max(h, 1); + if (canvas.width !== w || canvas.height !== h) { canvas.width = w; From 81609c42c7a883d115ca84d1074667c1adc9fe2f Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Mon, 22 Jan 2018 14:45:57 +0000 Subject: [PATCH 72/72] Beta 19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7dff26d3c..939dcefcc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "//": "npm publish --tag beta", "name": "phaser", - "version": "3.0.0-beta.18", + "version": "3.0.0-beta.19", "release": "Shadow Coast", "description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.", "author": "Richard Davey (http://www.photonstorm.com)",