Skip to content

Commit 3f4a4e1

Browse files
committed
New 2.4 build.
1 parent af66b49 commit 3f4a4e1

10 files changed

Lines changed: 199 additions & 34 deletions

build/custom/phaser-arcade-physics.js

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.4.0 "Katar" - Built: Wed May 06 2015 07:58:29
10+
* v2.4.0 "Katar" - Built: Wed May 06 2015 17:04:44
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -38904,13 +38904,13 @@ Phaser.Particle.prototype.reset = function(x, y, health) {
3890438904
* @constructor
3890538905
* @param {Phaser.Game} game - A reference to the currently running game.
3890638906
* @param {string} key - Internal Phaser reference key for the BitmapData.
38907-
* @param {number} [width=256] - The width of the BitmapData in pixels.
38908-
* @param {number} [height=256] - The height of the BitmapData in pixels.
38907+
* @param {number} [width=256] - The width of the BitmapData in pixels. If undefined or zero it's set to a default value.
38908+
* @param {number} [height=256] - The height of the BitmapData in pixels. If undefined or zero it's set to a default value.
3890938909
*/
3891038910
Phaser.BitmapData = function (game, key, width, height) {
3891138911

38912-
if (typeof width === 'undefined') { width = 256; }
38913-
if (typeof height === 'undefined') { height = 256; }
38912+
if (typeof width === 'undefined' || width === 0) { width = 256; }
38913+
if (typeof height === 'undefined' || height === 0) { height = 256; }
3891438914

3891538915
/**
3891638916
* @property {Phaser.Game} game - A reference to the currently running game.
@@ -72074,6 +72074,21 @@ Phaser.Video = function (game, key, captureAudio, width, height) {
7207472074
*/
7207572075
this.videoStream = null;
7207672076

72077+
/**
72078+
* A snapshot grabbed from the video. This is initially black. Populate it by calling Video.grab().
72079+
* When called the BitmapData is updated with a grab taken from the current video playing or active video stream.
72080+
* If Phaser has been compiled without BitmapData support this property will always be `null`.
72081+
*
72082+
* @property {Phaser.BitmapData} snapshot
72083+
* @readOnly
72084+
*/
72085+
this.snapshot = null;
72086+
72087+
if (Phaser.BitmapData)
72088+
{
72089+
this.snapshot = new Phaser.BitmapData(this.game, '', this.width, this.height);
72090+
}
72091+
7207772092
/**
7207872093
* @property {boolean} _codeMuted - Internal mute tracking var.
7207972094
* @private
@@ -72196,7 +72211,7 @@ Phaser.Video.prototype = {
7219672211

7219772212
var _streamError = function(e) {
7219872213
_this.onError.dispatch(_this, e);
72199-
}
72214+
};
7220072215

7220172216
navigator.getUserMedia({ audio: captureAudio, video: true }, _streamStart, _streamError);
7220272217

@@ -72238,7 +72253,7 @@ Phaser.Video.prototype = {
7223872253

7223972254
var change = false;
7224072255

72241-
if (typeof width === 'undefined' || width === null) { width = this.video.videoWidth; change = true }
72256+
if (typeof width === 'undefined' || width === null) { width = this.video.videoWidth; change = true; }
7224272257
if (typeof height === 'undefined' || height === null) { height = this.video.videoHeight; }
7224372258

7224472259
// if (change)
@@ -72258,6 +72273,11 @@ Phaser.Video.prototype = {
7225872273
this.texture.frame.width = width;
7225972274
this.texture.frame.height = height;
7226072275

72276+
if (this.snapshot)
72277+
{
72278+
this.snapshot.resize(width, height);
72279+
}
72280+
7226172281
if (change)
7226272282
{
7226372283
this.video.removeEventListener('canplaythrough', this.updateTexture.bind(this));
@@ -72302,6 +72322,11 @@ Phaser.Video.prototype = {
7230272322
{
7230372323
this.game.sound.onMute.add(this.setMute, this);
7230472324
this.game.sound.onUnMute.add(this.unsetMute, this);
72325+
72326+
if (this.game.sound.mute)
72327+
{
72328+
this.setMute();
72329+
}
7230572330
}
7230672331

7230772332
this.game.onPause.add(this.setPause, this);
@@ -72630,9 +72655,39 @@ Phaser.Video.prototype = {
7263072655

7263172656
},
7263272657

72633-
snapshot: function () {
72658+
/**
72659+
* Grabs the current frame from the Video or Video Stream and renders it to the Video.snapshot BitmapData.
72660+
*
72661+
* You can optionally set if the BitmapData should be cleared or not, the alpha and the blend mode of the draw.
72662+
*
72663+
* If you need more advanced control over the grabbing them call `Video.snapshot.copy` directly with the same parameters as BitmapData.copy.
72664+
*
72665+
* @method Phaser.Video#grab
72666+
* @param {boolean} [clear=false] - Should the BitmapData be cleared before the Video is grabbed? Unless you are using alpha or a blend mode you can usually leave this set to false.
72667+
* @param {number} [alpha=1] - The alpha that will be set on the video before drawing. A value between 0 (fully transparent) and 1, opaque.
72668+
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
72669+
* @return {Phaser.BitmapData} A reference to the Video.snapshot BitmapData object for further method chaining.
72670+
*/
72671+
grab: function (clear, alpha, blendMode) {
72672+
72673+
if (typeof clear === 'undefined') { clear = false; }
72674+
if (typeof alpha === 'undefined') { alpha = 1; }
72675+
if (typeof blendMode === 'undefined') { blendMode = null; }
72676+
72677+
if (this.snapshot === null)
72678+
{
72679+
console.warn('Video.grab cannot run because Phaser.BitmapData is unavailable');
72680+
return;
72681+
}
72682+
72683+
if (clear)
72684+
{
72685+
this.snapshot.cls();
72686+
}
7263472687

72688+
this.snapshot.copy(this.video, 0, 0, this.width, this.height, 0, 0, this.width, this.height, 0, 0, 0, 1, 1, alpha, blendMode);
7263572689

72690+
return this.snapshot;
7263672691

7263772692
},
7263872693

build/custom/phaser-arcade-physics.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-arcade-physics.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-minimum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.4.0 "Katar" - Built: Wed May 06 2015 07:58:46
10+
* v2.4.0 "Katar" - Built: Wed May 06 2015 17:05:01
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*

build/custom/phaser-no-physics.js

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Phaser - http://phaser.io
99
*
10-
* v2.4.0 "Katar" - Built: Wed May 06 2015 07:58:38
10+
* v2.4.0 "Katar" - Built: Wed May 06 2015 17:04:53
1111
*
1212
* By Richard Davey http://www.photonstorm.com @photonstorm
1313
*
@@ -38904,13 +38904,13 @@ Phaser.Particle.prototype.reset = function(x, y, health) {
3890438904
* @constructor
3890538905
* @param {Phaser.Game} game - A reference to the currently running game.
3890638906
* @param {string} key - Internal Phaser reference key for the BitmapData.
38907-
* @param {number} [width=256] - The width of the BitmapData in pixels.
38908-
* @param {number} [height=256] - The height of the BitmapData in pixels.
38907+
* @param {number} [width=256] - The width of the BitmapData in pixels. If undefined or zero it's set to a default value.
38908+
* @param {number} [height=256] - The height of the BitmapData in pixels. If undefined or zero it's set to a default value.
3890938909
*/
3891038910
Phaser.BitmapData = function (game, key, width, height) {
3891138911

38912-
if (typeof width === 'undefined') { width = 256; }
38913-
if (typeof height === 'undefined') { height = 256; }
38912+
if (typeof width === 'undefined' || width === 0) { width = 256; }
38913+
if (typeof height === 'undefined' || height === 0) { height = 256; }
3891438914

3891538915
/**
3891638916
* @property {Phaser.Game} game - A reference to the currently running game.
@@ -63627,6 +63627,21 @@ Phaser.Video = function (game, key, captureAudio, width, height) {
6362763627
*/
6362863628
this.videoStream = null;
6362963629

63630+
/**
63631+
* A snapshot grabbed from the video. This is initially black. Populate it by calling Video.grab().
63632+
* When called the BitmapData is updated with a grab taken from the current video playing or active video stream.
63633+
* If Phaser has been compiled without BitmapData support this property will always be `null`.
63634+
*
63635+
* @property {Phaser.BitmapData} snapshot
63636+
* @readOnly
63637+
*/
63638+
this.snapshot = null;
63639+
63640+
if (Phaser.BitmapData)
63641+
{
63642+
this.snapshot = new Phaser.BitmapData(this.game, '', this.width, this.height);
63643+
}
63644+
6363063645
/**
6363163646
* @property {boolean} _codeMuted - Internal mute tracking var.
6363263647
* @private
@@ -63749,7 +63764,7 @@ Phaser.Video.prototype = {
6374963764

6375063765
var _streamError = function(e) {
6375163766
_this.onError.dispatch(_this, e);
63752-
}
63767+
};
6375363768

6375463769
navigator.getUserMedia({ audio: captureAudio, video: true }, _streamStart, _streamError);
6375563770

@@ -63791,7 +63806,7 @@ Phaser.Video.prototype = {
6379163806

6379263807
var change = false;
6379363808

63794-
if (typeof width === 'undefined' || width === null) { width = this.video.videoWidth; change = true }
63809+
if (typeof width === 'undefined' || width === null) { width = this.video.videoWidth; change = true; }
6379563810
if (typeof height === 'undefined' || height === null) { height = this.video.videoHeight; }
6379663811

6379763812
// if (change)
@@ -63811,6 +63826,11 @@ Phaser.Video.prototype = {
6381163826
this.texture.frame.width = width;
6381263827
this.texture.frame.height = height;
6381363828

63829+
if (this.snapshot)
63830+
{
63831+
this.snapshot.resize(width, height);
63832+
}
63833+
6381463834
if (change)
6381563835
{
6381663836
this.video.removeEventListener('canplaythrough', this.updateTexture.bind(this));
@@ -63855,6 +63875,11 @@ Phaser.Video.prototype = {
6385563875
{
6385663876
this.game.sound.onMute.add(this.setMute, this);
6385763877
this.game.sound.onUnMute.add(this.unsetMute, this);
63878+
63879+
if (this.game.sound.mute)
63880+
{
63881+
this.setMute();
63882+
}
6385863883
}
6385963884

6386063885
this.game.onPause.add(this.setPause, this);
@@ -64183,9 +64208,39 @@ Phaser.Video.prototype = {
6418364208

6418464209
},
6418564210

64186-
snapshot: function () {
64211+
/**
64212+
* Grabs the current frame from the Video or Video Stream and renders it to the Video.snapshot BitmapData.
64213+
*
64214+
* You can optionally set if the BitmapData should be cleared or not, the alpha and the blend mode of the draw.
64215+
*
64216+
* If you need more advanced control over the grabbing them call `Video.snapshot.copy` directly with the same parameters as BitmapData.copy.
64217+
*
64218+
* @method Phaser.Video#grab
64219+
* @param {boolean} [clear=false] - Should the BitmapData be cleared before the Video is grabbed? Unless you are using alpha or a blend mode you can usually leave this set to false.
64220+
* @param {number} [alpha=1] - The alpha that will be set on the video before drawing. A value between 0 (fully transparent) and 1, opaque.
64221+
* @param {string} [blendMode=null] - The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.
64222+
* @return {Phaser.BitmapData} A reference to the Video.snapshot BitmapData object for further method chaining.
64223+
*/
64224+
grab: function (clear, alpha, blendMode) {
64225+
64226+
if (typeof clear === 'undefined') { clear = false; }
64227+
if (typeof alpha === 'undefined') { alpha = 1; }
64228+
if (typeof blendMode === 'undefined') { blendMode = null; }
64229+
64230+
if (this.snapshot === null)
64231+
{
64232+
console.warn('Video.grab cannot run because Phaser.BitmapData is unavailable');
64233+
return;
64234+
}
64235+
64236+
if (clear)
64237+
{
64238+
this.snapshot.cls();
64239+
}
6418764240

64241+
this.snapshot.copy(this.video, 0, 0, this.width, this.height, 0, 0, this.width, this.height, 0, 0, 0, 1, 1, alpha, blendMode);
6418864242

64243+
return this.snapshot;
6418964244

6419064245
},
6419164246

build/custom/phaser-no-physics.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/custom/phaser-no-physics.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)