3.61.0 Beta 1

This commit is contained in:
Richard Davey 2023-07-21 18:45:47 +01:00
parent 4ee569ff9e
commit da947e8b4c
10 changed files with 1401 additions and 349 deletions

View file

@ -576,7 +576,7 @@ var GetLast = function (items, compare, index)
{
if (index === undefined) { index = 0; }
for (var i = index; i < items.length; i++)
for (var i = items.length - 1; i >= index; i--)
{
var item = items[i];
@ -6784,7 +6784,7 @@ var AnimationState = new Class({
return;
}
this.accumulator += delta * this.timeScale;
this.accumulator += delta * this.timeScale * this.animationManager.globalTimeScale;
if (this._pendingStop === 1)
{
@ -15679,7 +15679,7 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
VERSION: '3.60.0',
VERSION: '3.61.0-beta.1',
BlendModes: __webpack_require__(95723),
@ -15908,22 +15908,22 @@ var Config = new Class({
/**
* @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minWidth = GetValue(scaleConfig, 'minWidth', 0, config);
this.minWidth = GetValue(scaleConfig, 'min.width', 0, config);
/**
* @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxWidth = GetValue(scaleConfig, 'maxWidth', 0, config);
this.maxWidth = GetValue(scaleConfig, 'max.width', 0, config);
/**
* @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minHeight = GetValue(scaleConfig, 'minHeight', 0, config);
this.minHeight = GetValue(scaleConfig, 'min.height', 0, config);
/**
* @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxHeight = GetValue(scaleConfig, 'maxHeight', 0, config);
this.maxHeight = GetValue(scaleConfig, 'max.height', 0, config);
/**
* @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default)
@ -31921,7 +31921,7 @@ var Blur = new Class({
* @type {number}
* @since 3.60.0
*/
this.quality = 0;
this.quality = quality;
/**
* The horizontal offset of the blur effect.
@ -32347,8 +32347,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255;
}
}
},
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.61.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
});
module.exports = Circle;
@ -32851,10 +32871,10 @@ var FX_CONST = __webpack_require__(47406);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/
var Gradient = new Class({
@ -32896,7 +32916,7 @@ var Gradient = new Class({
this.size = size;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromX
* @type {number}
@ -32905,7 +32925,7 @@ var Gradient = new Class({
this.fromX = fromX;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromY
* @type {number}
@ -32914,7 +32934,7 @@ var Gradient = new Class({
this.fromY = fromY;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toX
* @type {number}
@ -32923,7 +32943,7 @@ var Gradient = new Class({
this.toX = toX;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toY
* @type {number}
@ -37992,6 +38012,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
ty3 = Math.round(ty3);
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit);
}
@ -39678,6 +39704,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
continue;
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
if (charColors[char.i])
{
var color = charColors[char.i];
@ -42328,10 +42360,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*
* @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -43866,7 +43898,7 @@ var PathFollower = {
{
var tween = this.pathTween;
if (tween)
if (tween && tween.data)
{
var tweenData = tween.data[0];
var pathDelta = this.pathDelta;
@ -54057,6 +54089,16 @@ var Group = new Class({
this.removeCallback = options.removeCallback;
}
if (options.internalCreateCallback)
{
this.internalCreateCallback = options.internalCreateCallback;
}
if (options.internalRemoveCallback)
{
this.internalRemoveCallback = options.internalRemoveCallback;
}
for (var c = 0; c < range.length; c++)
{
var created = this.create(0, 0, range[c].a, range[c].b, visible, active);
@ -61549,7 +61591,7 @@ var EmitterOp = new Class({
// Custom onEmit onUpdate
return 8;
}
else if (this.has(value, 'interpolation'))
else if (this.hasEither(value, 'values', 'interpolation'))
{
// Interpolation
return 9;
@ -62879,12 +62921,15 @@ var Particle = new Class({
this.computeVelocity(emitter, delta, step, processors, t);
this.scaleX = ops.scaleX.onUpdate(this, 'scaleX', t, this.scaleX);
this.scaleY = this.scaleX;
if (ops.scaleY.active)
{
this.scaleY = ops.scaleY.onUpdate(this, 'scaleY', t, this.scaleY);
}
else
{
this.scaleY = this.scaleX;
}
this.angle = ops.rotate.onUpdate(this, 'rotate', t, this.angle);
@ -62898,7 +62943,7 @@ var Particle = new Class({
return true;
}
this.alpha = ops.alpha.onUpdate(this, 'alpha', t, this.alpha);
this.alpha = Clamp(ops.alpha.onUpdate(this, 'alpha', t, this.alpha), 0, 1);
if (ops.color.active)
{
@ -64949,6 +64994,21 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Death Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearDeathZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearDeathZones: function ()
{
this.deathZones.length = 0;
return this;
},
/**
* Adds a new Particle Emission Zone to this Emitter.
*
@ -65042,6 +65102,23 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Emission Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearEmitZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearEmitZones: function ()
{
this.emitZones.length = 0;
this.zoneIndex = 0;
return this;
},
/**
* Takes the given particle and sets its x/y coordinates to match the next available
* emission zone, if any have been configured. This method is called automatically
@ -66180,7 +66257,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleX
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleX: {
@ -66206,7 +66283,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleY
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleY: {
@ -70688,7 +70765,7 @@ var Vector2 = __webpack_require__(93736);
* The Rope object is WebGL only and does not have a Canvas counterpart.
*
* A Rope is a special kind of Game Object that has a texture is stretched along its entire length.
*
*
* Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define
* when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own
* color and alpha values as well.
@ -70947,6 +71024,7 @@ var Rope = new Class({
this.setPosition(x, y);
this.setSizeToFrame();
this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE);
this.initPostPipeline();
if (Array.isArray(points))
{
@ -80407,6 +80485,11 @@ var GetTextSize = function (text, size, lines)
lineWidth += context.measureText(lines[i]).width;
if (lines[i].length > 1)
{
lineWidth += text.letterSpacing * (lines[i].length - 1);
}
// Adjust for wrapped text
if (style.wordWrap)
{
@ -80832,6 +80915,19 @@ var Text = new Class({
*/
this.lineSpacing = 0;
/**
* Adds / Removes spacing between characters.
* Can be a negative or positive number.
*
* If you update this property directly, instead of using the `setLetterSpacing` method, then
* be sure to call `updateText` after, or you won't see the change reflected in the Text object.
*
* @name Phaser.GameObjects.Text#letterSpacing
* @type {number}
* @since 3.60.0
*/
this.letterSpacing = 0;
/**
* Whether the text or its settings have changed and need updating.
*
@ -81654,6 +81750,32 @@ var Text = new Class({
return this.updateText();
},
/**
* Sets the letter spacing value.
*
* This will add, or remove spacing between each character of this Text Game Object. The value can be
* either positive or negative. Positive values increase the space between each character, whilst negative
* values decrease it. Note that some fonts are spaced naturally closer together than others.
*
* Please understand that enabling this feature will cause Phaser to render each character in this Text object
* one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with
* either long strings, or lots of strings in total. You will be better off creating bitmap font text if you
* need to display large quantities of characters with fine control over the letter spacing.
*
* @method Phaser.GameObjects.Text#setLetterSpacing
* @since 3.61.0
*
* @param {number} value - The amount to add to the letter width. Set to zero to disable.
*
* @return {this} This Text object.
*/
setLetterSpacing: function (value)
{
this.letterSpacing = value;
return this.updateText();
},
/**
* Set the text padding.
*
@ -81735,6 +81857,55 @@ var Text = new Class({
return this.style.setMaxLines(max);
},
/**
* Render text from right-to-left or left-to-right.
*
* @method Phaser.GameObjects.Text#setRTL
* @since 3.61.0
*
* @param {boolean} [rtl=true] - Set to `true` to render from right-to-left.
*
* @return {this} This Text object.
*/
setRTL: function (rtl)
{
if (rtl === undefined) { rtl = true; }
var style = this.style;
if (style.rtl === rtl)
{
return this;
}
style.rtl = rtl;
if (rtl)
{
this.canvas.dir = 'rtl';
this.context.direction = 'rtl';
this.canvas.style.display = 'none';
AddToDOM(this.canvas, this.scene.sys.canvas);
}
else
{
this.canvas.dir = 'ltr';
this.context.direction = 'ltr';
}
if (style.align === 'left')
{
style.align = 'right';
}
else if (style.align === 'right')
{
style.align = 'left';
}
return this;
},
/**
* Update the displayed text.
*
@ -81913,7 +82084,28 @@ var Text = new Class({
{
style.syncShadow(context, style.shadowFill);
context.fillText(lines[i], linePositionX, linePositionY);
// Looping fillText could be an expensive operation, we should ignore it if it is not needed
var letterSpacing = this.letterSpacing;
if (letterSpacing !== 0)
{
var charPositionX = 0;
var line = lines[i].split('');
// Draw text letter by letter
for (var l = 0; l < line.length; l++)
{
context.fillText(line[l], linePositionX + charPositionX, linePositionY);
charPositionX += context.measureText(line[l]).width + letterSpacing;
}
}
else
{
context.fillText(lines[i], linePositionX, linePositionY);
}
}
}
@ -82016,10 +82208,7 @@ var Text = new Class({
*/
preDestroy: function ()
{
if (this.style.rtl)
{
RemoveFromDOM(this.canvas);
}
RemoveFromDOM(this.canvas);
CanvasPool.remove(this.canvas);
@ -135070,12 +135259,6 @@ module.exports = Within;
*/
var Wrap = function (value, min, max)
{
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min;
return (min + ((((value - min) % range) + range) % range));
@ -143481,17 +143664,16 @@ var PhysicsGroup = new Class({
else if (Array.isArray(children) && IsPlainObject(children[0]))
{
// children is an array of plain objects (i.e., configs)
config = children[0];
var _this = this;
children.forEach(function (singleConfig)
{
singleConfig.internalCreateCallback = _this.createCallbackHandler;
singleConfig.internalRemoveCallback = _this.removeCallbackHandler;
singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite);
});
children = null;
config = null;
}
else
{
@ -143522,7 +143704,10 @@ var PhysicsGroup = new Class({
* @since 3.0.0
* @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
if (config)
{
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
}
/**
* The physics type of the Group's members.
@ -147006,6 +147191,20 @@ var World = new Class({
this.stepsLastFrame++;
},
/**
* Advances the simulation by a single step.
*
* @method Phaser.Physics.Arcade.World#singleStep
* @fires Phaser.Physics.Arcade.Events#WORLD_STEP
* @since 3.61.0
*/
singleStep: function ()
{
this.update(0, this._frameTimeMS);
this.postUpdate();
},
/**
* Updates bodies, draws the debug display, and handles pending queue operations.
*
@ -168759,7 +168958,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BarrelFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -168836,7 +169035,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BloomFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -168993,7 +169192,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BlurFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169136,7 +169335,7 @@ var BlurFXPipeline = new Class({
var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
this.bind(this.activeShader);
this.bind(this.shaders[controller.quality]);
gl.activeTexture(gl.TEXTURE0);
gl.viewport(0, 0, target1.width, target1.height);
@ -169203,7 +169402,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BokehFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169362,7 +169561,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class CircleFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169498,7 +169697,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ColorMatrixFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169573,7 +169772,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class DisplacementFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169695,7 +169894,7 @@ var Utils = __webpack_require__(75512);
* ```
*
* @class GlowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169816,7 +170015,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class GradientFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -169858,7 +170057,7 @@ var GradientFXPipeline = new Class({
this.size = 0;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromX
* @type {number}
@ -169867,7 +170066,7 @@ var GradientFXPipeline = new Class({
this.fromX = 0;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromY
* @type {number}
@ -169876,7 +170075,7 @@ var GradientFXPipeline = new Class({
this.fromY = 0;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toX
* @type {number}
@ -169885,7 +170084,7 @@ var GradientFXPipeline = new Class({
this.toX = 0;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toY
* @type {number}
@ -169962,7 +170161,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class PixelateFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -170048,7 +170247,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShadowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -170186,7 +170385,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShineFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -170304,7 +170503,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class VignetteFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -170418,7 +170617,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class WipeFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -170810,6 +171009,7 @@ module.exports = [
'precision mediump float;',
'uniform sampler2D uMainSampler;',
'uniform vec2 resolution;',
'uniform vec2 offset;',
'uniform float strength;',
'uniform vec3 color;',
'varying vec2 outTexCoord;',
@ -170817,7 +171017,7 @@ module.exports = [
'{',
' vec2 uv = outTexCoord;',
' vec4 col = vec4(0.0);',
' vec2 offset = vec2(1.333) * strength;',
' vec2 offset = vec2(1.333) * offset * strength;',
' col += texture2D(uMainSampler, uv) * 0.29411764705882354;',
' col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;',
' col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;',
@ -185324,7 +185524,7 @@ var WebAudioSoundManager = new Class({
{
if (_this.context && body)
{
var bodyRemove = body.removeEventListener;
var bodyRemove = body.removeEventListener.bind(body);
_this.context.resume().then(function ()
{
@ -193798,7 +193998,7 @@ var TextureManager = new Class({
if (source instanceof Texture)
{
key = texture.key;
key = source.key;
texture = source;
}
else if (this.checkKey(key))
@ -196755,11 +196955,19 @@ var ObjectHelper = new Class({
if (Array.isArray(properties))
{
// Tiled objects custom properties format
properties.forEach(function (propData)
for (var i = 0; i < properties.length; i++)
{
sprite.setData(propData.name, propData.value);
});
var prop = properties[i];
if (sprite[prop.name] !== undefined)
{
sprite[prop.name] = prop.value;
}
else
{
sprite.setData(prop.name, prop.value);
}
}
return;
}
@ -198522,12 +198730,25 @@ var Tilemap = new Class({
* class must have {@link Phaser.GameObjects.Components.Transform#setPosition setPosition} and
* {@link Phaser.GameObjects.Components.Texture#setTexture setTexture} methods.
*
* Custom properties on the Object are copied onto any existing properties on the Game Object, so you can use this as an easy
* way to configure properties from within the map editor. For example giving an Object a
* property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created.
* This method will set the following Tiled Object properties on the new Game Object:
*
* Custom properties that do not exist on the Game Object are set in the
* Game Object's {@link Phaser.GameObjects.GameObject#data data store}.
* - `flippedHorizontal` as `flipX`
* - `flippedVertical` as `flipY`
* - `height` as `displayHeight`
* - `name`
* - `rotation`
* - `visible`
* - `width` as `displayWidth`
* - `x`, adjusted for origin
* - `y`, adjusted for origin
*
* Additionally, this method will set Tiled Object custom properties
*
* - on the Game Object, if it has the same property name and a value that isn't `undefined`; or
* - on the Game Object's {@link Phaser.GameObjects.GameObject#data data store} otherwise.
*
* For example, a Tiled Object with custom properties `{ alpha: 0.5, gold: 1 }` will be created as a Game
* Object with an `alpha` value of 0.5 and a `data.values.gold` value of 1.
*
* When `useTileset` is `true` (the default), Tile Objects will inherit the texture and any tile properties
* from the tileset, and the local tile ID will be used as the texture frame. For the frame selection to work
@ -204564,7 +204785,7 @@ var HexagonalCullBounds = function (layer, camera)
var boundsTop;
var boundsBottom;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
var rowH = ((tileH - len) / 2 + len);
@ -204705,7 +204926,7 @@ var HexagonalGetTileCorners = function (tileX, tileY, camera, layer)
var hexWidth;
var hexHeight;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
hexWidth = b0 * tileWidth;
hexHeight = tileHeight / 2;
@ -204789,7 +205010,7 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
var x;
var y;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
x = worldX + (tileWidth * tileX) + tileWidth;
y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf;
@ -205362,9 +205583,10 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
}
else
{
var tiles = layer.tilemapLayer.tilemap.tiles;
var tilemap = layer.tilemaplayer.tilemap;
var tiles = tilemap.tiles;
var sid = tiles[index][2];
var set = layer.tilemapLayer.tileset[sid];
var set = tilemap.tileset[sid];
newTile.width = set.tileWidth;
newTile.height = set.tileHeight;
@ -207643,6 +207865,17 @@ var LayerData = new Class({
*/
this.name = GetFastValue(config, 'name', 'layer');
/**
* The id of the layer, as specified in the map data.
*
* Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
*
* @name Phaser.Tilemaps.LayerData#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The x offset of where to draw from the top left.
*
@ -208178,6 +208411,15 @@ var ObjectLayer = new Class({
*/
this.name = GetFastValue(config, 'name', 'object layer');
/**
* The id of the object layer, as specified in the map data.
*
* @name Phaser.Tilemaps.ObjectLayer#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The opacity of the layer, between 0 and 1.
*
@ -209630,6 +209872,7 @@ var ParseTileLayers = function (json, insertNull)
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight),
width: curl.width,
@ -209710,6 +209953,7 @@ var ParseTileLayers = function (json, insertNull)
{
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y),
width: curl.width,
@ -215317,7 +215561,10 @@ var BaseTween = new Class({
*/
remove: function ()
{
this.parent.remove(this);
if (this.parent)
{
this.parent.remove(this);
}
return this;
},
@ -215343,7 +215590,7 @@ var BaseTween = new Class({
*/
stop: function ()
{
if (!this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
if (this.parent && !this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
{
this.dispatchEvent(Events.TWEEN_STOP, 'onStop');
@ -221942,12 +222189,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateLeft = function (matrix)
var RotateLeft = function (matrix, amount)
{
return RotateMatrix(matrix, 90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
};
module.exports = RotateLeft;
@ -222077,12 +222332,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateRight = function (matrix)
var RotateRight = function (matrix, amount)
{
return RotateMatrix(matrix, -90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
};
module.exports = RotateRight;

File diff suppressed because one or more lines are too long

435
dist/phaser-ie9.js vendored
View file

@ -576,7 +576,7 @@ var GetLast = function (items, compare, index)
{
if (index === undefined) { index = 0; }
for (var i = index; i < items.length; i++)
for (var i = items.length - 1; i >= index; i--)
{
var item = items[i];
@ -6784,7 +6784,7 @@ var AnimationState = new Class({
return;
}
this.accumulator += delta * this.timeScale;
this.accumulator += delta * this.timeScale * this.animationManager.globalTimeScale;
if (this._pendingStop === 1)
{
@ -15679,7 +15679,7 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
VERSION: '3.60.0',
VERSION: '3.61.0-beta.1',
BlendModes: __webpack_require__(95723),
@ -15908,22 +15908,22 @@ var Config = new Class({
/**
* @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minWidth = GetValue(scaleConfig, 'minWidth', 0, config);
this.minWidth = GetValue(scaleConfig, 'min.width', 0, config);
/**
* @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxWidth = GetValue(scaleConfig, 'maxWidth', 0, config);
this.maxWidth = GetValue(scaleConfig, 'max.width', 0, config);
/**
* @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minHeight = GetValue(scaleConfig, 'minHeight', 0, config);
this.minHeight = GetValue(scaleConfig, 'min.height', 0, config);
/**
* @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxHeight = GetValue(scaleConfig, 'maxHeight', 0, config);
this.maxHeight = GetValue(scaleConfig, 'max.height', 0, config);
/**
* @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default)
@ -31921,7 +31921,7 @@ var Blur = new Class({
* @type {number}
* @since 3.60.0
*/
this.quality = 0;
this.quality = quality;
/**
* The horizontal offset of the blur effect.
@ -32347,8 +32347,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255;
}
}
},
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.61.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
});
module.exports = Circle;
@ -32851,10 +32871,10 @@ var FX_CONST = __webpack_require__(47406);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/
var Gradient = new Class({
@ -32896,7 +32916,7 @@ var Gradient = new Class({
this.size = size;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromX
* @type {number}
@ -32905,7 +32925,7 @@ var Gradient = new Class({
this.fromX = fromX;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromY
* @type {number}
@ -32914,7 +32934,7 @@ var Gradient = new Class({
this.fromY = fromY;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toX
* @type {number}
@ -32923,7 +32943,7 @@ var Gradient = new Class({
this.toX = toX;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toY
* @type {number}
@ -37992,6 +38012,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
ty3 = Math.round(ty3);
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit);
}
@ -39678,6 +39704,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
continue;
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
if (charColors[char.i])
{
var color = charColors[char.i];
@ -42328,10 +42360,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*
* @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -43866,7 +43898,7 @@ var PathFollower = {
{
var tween = this.pathTween;
if (tween)
if (tween && tween.data)
{
var tweenData = tween.data[0];
var pathDelta = this.pathDelta;
@ -54057,6 +54089,16 @@ var Group = new Class({
this.removeCallback = options.removeCallback;
}
if (options.internalCreateCallback)
{
this.internalCreateCallback = options.internalCreateCallback;
}
if (options.internalRemoveCallback)
{
this.internalRemoveCallback = options.internalRemoveCallback;
}
for (var c = 0; c < range.length; c++)
{
var created = this.create(0, 0, range[c].a, range[c].b, visible, active);
@ -61549,7 +61591,7 @@ var EmitterOp = new Class({
// Custom onEmit onUpdate
return 8;
}
else if (this.has(value, 'interpolation'))
else if (this.hasEither(value, 'values', 'interpolation'))
{
// Interpolation
return 9;
@ -62879,12 +62921,15 @@ var Particle = new Class({
this.computeVelocity(emitter, delta, step, processors, t);
this.scaleX = ops.scaleX.onUpdate(this, 'scaleX', t, this.scaleX);
this.scaleY = this.scaleX;
if (ops.scaleY.active)
{
this.scaleY = ops.scaleY.onUpdate(this, 'scaleY', t, this.scaleY);
}
else
{
this.scaleY = this.scaleX;
}
this.angle = ops.rotate.onUpdate(this, 'rotate', t, this.angle);
@ -62898,7 +62943,7 @@ var Particle = new Class({
return true;
}
this.alpha = ops.alpha.onUpdate(this, 'alpha', t, this.alpha);
this.alpha = Clamp(ops.alpha.onUpdate(this, 'alpha', t, this.alpha), 0, 1);
if (ops.color.active)
{
@ -64949,6 +64994,21 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Death Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearDeathZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearDeathZones: function ()
{
this.deathZones.length = 0;
return this;
},
/**
* Adds a new Particle Emission Zone to this Emitter.
*
@ -65042,6 +65102,23 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Emission Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearEmitZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearEmitZones: function ()
{
this.emitZones.length = 0;
this.zoneIndex = 0;
return this;
},
/**
* Takes the given particle and sets its x/y coordinates to match the next available
* emission zone, if any have been configured. This method is called automatically
@ -66180,7 +66257,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleX
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleX: {
@ -66206,7 +66283,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleY
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleY: {
@ -70688,7 +70765,7 @@ var Vector2 = __webpack_require__(93736);
* The Rope object is WebGL only and does not have a Canvas counterpart.
*
* A Rope is a special kind of Game Object that has a texture is stretched along its entire length.
*
*
* Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define
* when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own
* color and alpha values as well.
@ -70947,6 +71024,7 @@ var Rope = new Class({
this.setPosition(x, y);
this.setSizeToFrame();
this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE);
this.initPostPipeline();
if (Array.isArray(points))
{
@ -80407,6 +80485,11 @@ var GetTextSize = function (text, size, lines)
lineWidth += context.measureText(lines[i]).width;
if (lines[i].length > 1)
{
lineWidth += text.letterSpacing * (lines[i].length - 1);
}
// Adjust for wrapped text
if (style.wordWrap)
{
@ -80832,6 +80915,19 @@ var Text = new Class({
*/
this.lineSpacing = 0;
/**
* Adds / Removes spacing between characters.
* Can be a negative or positive number.
*
* If you update this property directly, instead of using the `setLetterSpacing` method, then
* be sure to call `updateText` after, or you won't see the change reflected in the Text object.
*
* @name Phaser.GameObjects.Text#letterSpacing
* @type {number}
* @since 3.60.0
*/
this.letterSpacing = 0;
/**
* Whether the text or its settings have changed and need updating.
*
@ -81654,6 +81750,32 @@ var Text = new Class({
return this.updateText();
},
/**
* Sets the letter spacing value.
*
* This will add, or remove spacing between each character of this Text Game Object. The value can be
* either positive or negative. Positive values increase the space between each character, whilst negative
* values decrease it. Note that some fonts are spaced naturally closer together than others.
*
* Please understand that enabling this feature will cause Phaser to render each character in this Text object
* one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with
* either long strings, or lots of strings in total. You will be better off creating bitmap font text if you
* need to display large quantities of characters with fine control over the letter spacing.
*
* @method Phaser.GameObjects.Text#setLetterSpacing
* @since 3.61.0
*
* @param {number} value - The amount to add to the letter width. Set to zero to disable.
*
* @return {this} This Text object.
*/
setLetterSpacing: function (value)
{
this.letterSpacing = value;
return this.updateText();
},
/**
* Set the text padding.
*
@ -81735,6 +81857,55 @@ var Text = new Class({
return this.style.setMaxLines(max);
},
/**
* Render text from right-to-left or left-to-right.
*
* @method Phaser.GameObjects.Text#setRTL
* @since 3.61.0
*
* @param {boolean} [rtl=true] - Set to `true` to render from right-to-left.
*
* @return {this} This Text object.
*/
setRTL: function (rtl)
{
if (rtl === undefined) { rtl = true; }
var style = this.style;
if (style.rtl === rtl)
{
return this;
}
style.rtl = rtl;
if (rtl)
{
this.canvas.dir = 'rtl';
this.context.direction = 'rtl';
this.canvas.style.display = 'none';
AddToDOM(this.canvas, this.scene.sys.canvas);
}
else
{
this.canvas.dir = 'ltr';
this.context.direction = 'ltr';
}
if (style.align === 'left')
{
style.align = 'right';
}
else if (style.align === 'right')
{
style.align = 'left';
}
return this;
},
/**
* Update the displayed text.
*
@ -81913,7 +82084,28 @@ var Text = new Class({
{
style.syncShadow(context, style.shadowFill);
context.fillText(lines[i], linePositionX, linePositionY);
// Looping fillText could be an expensive operation, we should ignore it if it is not needed
var letterSpacing = this.letterSpacing;
if (letterSpacing !== 0)
{
var charPositionX = 0;
var line = lines[i].split('');
// Draw text letter by letter
for (var l = 0; l < line.length; l++)
{
context.fillText(line[l], linePositionX + charPositionX, linePositionY);
charPositionX += context.measureText(line[l]).width + letterSpacing;
}
}
else
{
context.fillText(lines[i], linePositionX, linePositionY);
}
}
}
@ -82016,10 +82208,7 @@ var Text = new Class({
*/
preDestroy: function ()
{
if (this.style.rtl)
{
RemoveFromDOM(this.canvas);
}
RemoveFromDOM(this.canvas);
CanvasPool.remove(this.canvas);
@ -135070,12 +135259,6 @@ module.exports = Within;
*/
var Wrap = function (value, min, max)
{
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min;
return (min + ((((value - min) % range) + range) % range));
@ -143478,17 +143661,16 @@ var PhysicsGroup = new Class({
else if (Array.isArray(children) && IsPlainObject(children[0]))
{
// children is an array of plain objects (i.e., configs)
config = children[0];
var _this = this;
children.forEach(function (singleConfig)
{
singleConfig.internalCreateCallback = _this.createCallbackHandler;
singleConfig.internalRemoveCallback = _this.removeCallbackHandler;
singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite);
});
children = null;
config = null;
}
else
{
@ -143519,7 +143701,10 @@ var PhysicsGroup = new Class({
* @since 3.0.0
* @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
if (config)
{
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
}
/**
* The physics type of the Group's members.
@ -147003,6 +147188,20 @@ var World = new Class({
this.stepsLastFrame++;
},
/**
* Advances the simulation by a single step.
*
* @method Phaser.Physics.Arcade.World#singleStep
* @fires Phaser.Physics.Arcade.Events#WORLD_STEP
* @since 3.61.0
*/
singleStep: function ()
{
this.update(0, this._frameTimeMS);
this.postUpdate();
},
/**
* Updates bodies, draws the debug display, and handles pending queue operations.
*
@ -164784,7 +164983,7 @@ var Body = __webpack_require__(84125);
for (var i = 0; i < bodiesLength; i++) {
var body = bodies[i];
if (body.isStatic || body.isSleeping)
if (body.ignoreGravity || body.isStatic || body.isSleeping)
continue;
// add the resultant force of gravity
@ -187241,7 +187440,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BarrelFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187318,7 +187517,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BloomFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187475,7 +187674,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BlurFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187618,7 +187817,7 @@ var BlurFXPipeline = new Class({
var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
this.bind(this.activeShader);
this.bind(this.shaders[controller.quality]);
gl.activeTexture(gl.TEXTURE0);
gl.viewport(0, 0, target1.width, target1.height);
@ -187685,7 +187884,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BokehFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187844,7 +188043,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class CircleFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187980,7 +188179,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ColorMatrixFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188055,7 +188254,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class DisplacementFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188177,7 +188376,7 @@ var Utils = __webpack_require__(75512);
* ```
*
* @class GlowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188298,7 +188497,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class GradientFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188340,7 +188539,7 @@ var GradientFXPipeline = new Class({
this.size = 0;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromX
* @type {number}
@ -188349,7 +188548,7 @@ var GradientFXPipeline = new Class({
this.fromX = 0;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromY
* @type {number}
@ -188358,7 +188557,7 @@ var GradientFXPipeline = new Class({
this.fromY = 0;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toX
* @type {number}
@ -188367,7 +188566,7 @@ var GradientFXPipeline = new Class({
this.toX = 0;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toY
* @type {number}
@ -188444,7 +188643,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class PixelateFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188530,7 +188729,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShadowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188668,7 +188867,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShineFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188786,7 +188985,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class VignetteFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188900,7 +189099,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class WipeFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -189292,6 +189491,7 @@ module.exports = [
'precision mediump float;',
'uniform sampler2D uMainSampler;',
'uniform vec2 resolution;',
'uniform vec2 offset;',
'uniform float strength;',
'uniform vec3 color;',
'varying vec2 outTexCoord;',
@ -189299,7 +189499,7 @@ module.exports = [
'{',
' vec2 uv = outTexCoord;',
' vec4 col = vec4(0.0);',
' vec2 offset = vec2(1.333) * strength;',
' vec2 offset = vec2(1.333) * offset * strength;',
' col += texture2D(uMainSampler, uv) * 0.29411764705882354;',
' col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;',
' col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;',
@ -203806,7 +204006,7 @@ var WebAudioSoundManager = new Class({
{
if (_this.context && body)
{
var bodyRemove = body.removeEventListener;
var bodyRemove = body.removeEventListener.bind(body);
_this.context.resume().then(function ()
{
@ -212280,7 +212480,7 @@ var TextureManager = new Class({
if (source instanceof Texture)
{
key = texture.key;
key = source.key;
texture = source;
}
else if (this.checkKey(key))
@ -215237,11 +215437,19 @@ var ObjectHelper = new Class({
if (Array.isArray(properties))
{
// Tiled objects custom properties format
properties.forEach(function (propData)
for (var i = 0; i < properties.length; i++)
{
sprite.setData(propData.name, propData.value);
});
var prop = properties[i];
if (sprite[prop.name] !== undefined)
{
sprite[prop.name] = prop.value;
}
else
{
sprite.setData(prop.name, prop.value);
}
}
return;
}
@ -217004,12 +217212,25 @@ var Tilemap = new Class({
* class must have {@link Phaser.GameObjects.Components.Transform#setPosition setPosition} and
* {@link Phaser.GameObjects.Components.Texture#setTexture setTexture} methods.
*
* Custom properties on the Object are copied onto any existing properties on the Game Object, so you can use this as an easy
* way to configure properties from within the map editor. For example giving an Object a
* property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created.
* This method will set the following Tiled Object properties on the new Game Object:
*
* Custom properties that do not exist on the Game Object are set in the
* Game Object's {@link Phaser.GameObjects.GameObject#data data store}.
* - `flippedHorizontal` as `flipX`
* - `flippedVertical` as `flipY`
* - `height` as `displayHeight`
* - `name`
* - `rotation`
* - `visible`
* - `width` as `displayWidth`
* - `x`, adjusted for origin
* - `y`, adjusted for origin
*
* Additionally, this method will set Tiled Object custom properties
*
* - on the Game Object, if it has the same property name and a value that isn't `undefined`; or
* - on the Game Object's {@link Phaser.GameObjects.GameObject#data data store} otherwise.
*
* For example, a Tiled Object with custom properties `{ alpha: 0.5, gold: 1 }` will be created as a Game
* Object with an `alpha` value of 0.5 and a `data.values.gold` value of 1.
*
* When `useTileset` is `true` (the default), Tile Objects will inherit the texture and any tile properties
* from the tileset, and the local tile ID will be used as the texture frame. For the frame selection to work
@ -223046,7 +223267,7 @@ var HexagonalCullBounds = function (layer, camera)
var boundsTop;
var boundsBottom;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
var rowH = ((tileH - len) / 2 + len);
@ -223187,7 +223408,7 @@ var HexagonalGetTileCorners = function (tileX, tileY, camera, layer)
var hexWidth;
var hexHeight;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
hexWidth = b0 * tileWidth;
hexHeight = tileHeight / 2;
@ -223271,7 +223492,7 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
var x;
var y;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
x = worldX + (tileWidth * tileX) + tileWidth;
y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf;
@ -223844,9 +224065,10 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
}
else
{
var tiles = layer.tilemapLayer.tilemap.tiles;
var tilemap = layer.tilemaplayer.tilemap;
var tiles = tilemap.tiles;
var sid = tiles[index][2];
var set = layer.tilemapLayer.tileset[sid];
var set = tilemap.tileset[sid];
newTile.width = set.tileWidth;
newTile.height = set.tileHeight;
@ -226125,6 +226347,17 @@ var LayerData = new Class({
*/
this.name = GetFastValue(config, 'name', 'layer');
/**
* The id of the layer, as specified in the map data.
*
* Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
*
* @name Phaser.Tilemaps.LayerData#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The x offset of where to draw from the top left.
*
@ -226660,6 +226893,15 @@ var ObjectLayer = new Class({
*/
this.name = GetFastValue(config, 'name', 'object layer');
/**
* The id of the object layer, as specified in the map data.
*
* @name Phaser.Tilemaps.ObjectLayer#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The opacity of the layer, between 0 and 1.
*
@ -228112,6 +228354,7 @@ var ParseTileLayers = function (json, insertNull)
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight),
width: curl.width,
@ -228192,6 +228435,7 @@ var ParseTileLayers = function (json, insertNull)
{
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y),
width: curl.width,
@ -233799,7 +234043,10 @@ var BaseTween = new Class({
*/
remove: function ()
{
this.parent.remove(this);
if (this.parent)
{
this.parent.remove(this);
}
return this;
},
@ -233825,7 +234072,7 @@ var BaseTween = new Class({
*/
stop: function ()
{
if (!this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
if (this.parent && !this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
{
this.dispatchEvent(Events.TWEEN_STOP, 'onStop');
@ -240424,12 +240671,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateLeft = function (matrix)
var RotateLeft = function (matrix, amount)
{
return RotateMatrix(matrix, 90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
};
module.exports = RotateLeft;
@ -240559,12 +240814,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateRight = function (matrix)
var RotateRight = function (matrix, amount)
{
return RotateMatrix(matrix, -90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
};
module.exports = RotateRight;

File diff suppressed because one or more lines are too long

435
dist/phaser.esm.js vendored
View file

@ -564,7 +564,7 @@ var GetLast = function (items, compare, index)
{
if (index === undefined) { index = 0; }
for (var i = index; i < items.length; i++)
for (var i = items.length - 1; i >= index; i--)
{
var item = items[i];
@ -6772,7 +6772,7 @@ var AnimationState = new Class({
return;
}
this.accumulator += delta * this.timeScale;
this.accumulator += delta * this.timeScale * this.animationManager.globalTimeScale;
if (this._pendingStop === 1)
{
@ -15667,7 +15667,7 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
VERSION: '3.60.0',
VERSION: '3.61.0-beta.1',
BlendModes: __webpack_require__(95723),
@ -15896,22 +15896,22 @@ var Config = new Class({
/**
* @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minWidth = GetValue(scaleConfig, 'minWidth', 0, config);
this.minWidth = GetValue(scaleConfig, 'min.width', 0, config);
/**
* @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxWidth = GetValue(scaleConfig, 'maxWidth', 0, config);
this.maxWidth = GetValue(scaleConfig, 'max.width', 0, config);
/**
* @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minHeight = GetValue(scaleConfig, 'minHeight', 0, config);
this.minHeight = GetValue(scaleConfig, 'min.height', 0, config);
/**
* @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxHeight = GetValue(scaleConfig, 'maxHeight', 0, config);
this.maxHeight = GetValue(scaleConfig, 'max.height', 0, config);
/**
* @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default)
@ -31909,7 +31909,7 @@ var Blur = new Class({
* @type {number}
* @since 3.60.0
*/
this.quality = 0;
this.quality = quality;
/**
* The horizontal offset of the blur effect.
@ -32335,8 +32335,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255;
}
}
},
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.61.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
});
module.exports = Circle;
@ -32839,10 +32859,10 @@ var FX_CONST = __webpack_require__(47406);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/
var Gradient = new Class({
@ -32884,7 +32904,7 @@ var Gradient = new Class({
this.size = size;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromX
* @type {number}
@ -32893,7 +32913,7 @@ var Gradient = new Class({
this.fromX = fromX;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromY
* @type {number}
@ -32902,7 +32922,7 @@ var Gradient = new Class({
this.fromY = fromY;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toX
* @type {number}
@ -32911,7 +32931,7 @@ var Gradient = new Class({
this.toX = toX;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toY
* @type {number}
@ -37980,6 +38000,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
ty3 = Math.round(ty3);
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit);
}
@ -39666,6 +39692,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
continue;
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
if (charColors[char.i])
{
var color = charColors[char.i];
@ -42316,10 +42348,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*
* @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -43854,7 +43886,7 @@ var PathFollower = {
{
var tween = this.pathTween;
if (tween)
if (tween && tween.data)
{
var tweenData = tween.data[0];
var pathDelta = this.pathDelta;
@ -54045,6 +54077,16 @@ var Group = new Class({
this.removeCallback = options.removeCallback;
}
if (options.internalCreateCallback)
{
this.internalCreateCallback = options.internalCreateCallback;
}
if (options.internalRemoveCallback)
{
this.internalRemoveCallback = options.internalRemoveCallback;
}
for (var c = 0; c < range.length; c++)
{
var created = this.create(0, 0, range[c].a, range[c].b, visible, active);
@ -61537,7 +61579,7 @@ var EmitterOp = new Class({
// Custom onEmit onUpdate
return 8;
}
else if (this.has(value, 'interpolation'))
else if (this.hasEither(value, 'values', 'interpolation'))
{
// Interpolation
return 9;
@ -62867,12 +62909,15 @@ var Particle = new Class({
this.computeVelocity(emitter, delta, step, processors, t);
this.scaleX = ops.scaleX.onUpdate(this, 'scaleX', t, this.scaleX);
this.scaleY = this.scaleX;
if (ops.scaleY.active)
{
this.scaleY = ops.scaleY.onUpdate(this, 'scaleY', t, this.scaleY);
}
else
{
this.scaleY = this.scaleX;
}
this.angle = ops.rotate.onUpdate(this, 'rotate', t, this.angle);
@ -62886,7 +62931,7 @@ var Particle = new Class({
return true;
}
this.alpha = ops.alpha.onUpdate(this, 'alpha', t, this.alpha);
this.alpha = Clamp(ops.alpha.onUpdate(this, 'alpha', t, this.alpha), 0, 1);
if (ops.color.active)
{
@ -64937,6 +64982,21 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Death Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearDeathZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearDeathZones: function ()
{
this.deathZones.length = 0;
return this;
},
/**
* Adds a new Particle Emission Zone to this Emitter.
*
@ -65030,6 +65090,23 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Emission Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearEmitZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearEmitZones: function ()
{
this.emitZones.length = 0;
this.zoneIndex = 0;
return this;
},
/**
* Takes the given particle and sets its x/y coordinates to match the next available
* emission zone, if any have been configured. This method is called automatically
@ -66168,7 +66245,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleX
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleX: {
@ -66194,7 +66271,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleY
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleY: {
@ -70676,7 +70753,7 @@ var Vector2 = __webpack_require__(93736);
* The Rope object is WebGL only and does not have a Canvas counterpart.
*
* A Rope is a special kind of Game Object that has a texture is stretched along its entire length.
*
*
* Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define
* when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own
* color and alpha values as well.
@ -70935,6 +71012,7 @@ var Rope = new Class({
this.setPosition(x, y);
this.setSizeToFrame();
this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE);
this.initPostPipeline();
if (Array.isArray(points))
{
@ -80395,6 +80473,11 @@ var GetTextSize = function (text, size, lines)
lineWidth += context.measureText(lines[i]).width;
if (lines[i].length > 1)
{
lineWidth += text.letterSpacing * (lines[i].length - 1);
}
// Adjust for wrapped text
if (style.wordWrap)
{
@ -80820,6 +80903,19 @@ var Text = new Class({
*/
this.lineSpacing = 0;
/**
* Adds / Removes spacing between characters.
* Can be a negative or positive number.
*
* If you update this property directly, instead of using the `setLetterSpacing` method, then
* be sure to call `updateText` after, or you won't see the change reflected in the Text object.
*
* @name Phaser.GameObjects.Text#letterSpacing
* @type {number}
* @since 3.60.0
*/
this.letterSpacing = 0;
/**
* Whether the text or its settings have changed and need updating.
*
@ -81642,6 +81738,32 @@ var Text = new Class({
return this.updateText();
},
/**
* Sets the letter spacing value.
*
* This will add, or remove spacing between each character of this Text Game Object. The value can be
* either positive or negative. Positive values increase the space between each character, whilst negative
* values decrease it. Note that some fonts are spaced naturally closer together than others.
*
* Please understand that enabling this feature will cause Phaser to render each character in this Text object
* one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with
* either long strings, or lots of strings in total. You will be better off creating bitmap font text if you
* need to display large quantities of characters with fine control over the letter spacing.
*
* @method Phaser.GameObjects.Text#setLetterSpacing
* @since 3.61.0
*
* @param {number} value - The amount to add to the letter width. Set to zero to disable.
*
* @return {this} This Text object.
*/
setLetterSpacing: function (value)
{
this.letterSpacing = value;
return this.updateText();
},
/**
* Set the text padding.
*
@ -81723,6 +81845,55 @@ var Text = new Class({
return this.style.setMaxLines(max);
},
/**
* Render text from right-to-left or left-to-right.
*
* @method Phaser.GameObjects.Text#setRTL
* @since 3.61.0
*
* @param {boolean} [rtl=true] - Set to `true` to render from right-to-left.
*
* @return {this} This Text object.
*/
setRTL: function (rtl)
{
if (rtl === undefined) { rtl = true; }
var style = this.style;
if (style.rtl === rtl)
{
return this;
}
style.rtl = rtl;
if (rtl)
{
this.canvas.dir = 'rtl';
this.context.direction = 'rtl';
this.canvas.style.display = 'none';
AddToDOM(this.canvas, this.scene.sys.canvas);
}
else
{
this.canvas.dir = 'ltr';
this.context.direction = 'ltr';
}
if (style.align === 'left')
{
style.align = 'right';
}
else if (style.align === 'right')
{
style.align = 'left';
}
return this;
},
/**
* Update the displayed text.
*
@ -81901,7 +82072,28 @@ var Text = new Class({
{
style.syncShadow(context, style.shadowFill);
context.fillText(lines[i], linePositionX, linePositionY);
// Looping fillText could be an expensive operation, we should ignore it if it is not needed
var letterSpacing = this.letterSpacing;
if (letterSpacing !== 0)
{
var charPositionX = 0;
var line = lines[i].split('');
// Draw text letter by letter
for (var l = 0; l < line.length; l++)
{
context.fillText(line[l], linePositionX + charPositionX, linePositionY);
charPositionX += context.measureText(line[l]).width + letterSpacing;
}
}
else
{
context.fillText(lines[i], linePositionX, linePositionY);
}
}
}
@ -82004,10 +82196,7 @@ var Text = new Class({
*/
preDestroy: function ()
{
if (this.style.rtl)
{
RemoveFromDOM(this.canvas);
}
RemoveFromDOM(this.canvas);
CanvasPool.remove(this.canvas);
@ -135057,12 +135246,6 @@ module.exports = Within;
*/
var Wrap = function (value, min, max)
{
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min;
return (min + ((((value - min) % range) + range) % range));
@ -143371,17 +143554,16 @@ var PhysicsGroup = new Class({
else if (Array.isArray(children) && IsPlainObject(children[0]))
{
// children is an array of plain objects (i.e., configs)
config = children[0];
var _this = this;
children.forEach(function (singleConfig)
{
singleConfig.internalCreateCallback = _this.createCallbackHandler;
singleConfig.internalRemoveCallback = _this.removeCallbackHandler;
singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite);
});
children = null;
config = null;
}
else
{
@ -143412,7 +143594,10 @@ var PhysicsGroup = new Class({
* @since 3.0.0
* @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
if (config)
{
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
}
/**
* The physics type of the Group's members.
@ -146896,6 +147081,20 @@ var World = new Class({
this.stepsLastFrame++;
},
/**
* Advances the simulation by a single step.
*
* @method Phaser.Physics.Arcade.World#singleStep
* @fires Phaser.Physics.Arcade.Events#WORLD_STEP
* @since 3.61.0
*/
singleStep: function ()
{
this.update(0, this._frameTimeMS);
this.postUpdate();
},
/**
* Updates bodies, draws the debug display, and handles pending queue operations.
*
@ -164677,7 +164876,7 @@ var Body = __webpack_require__(84125);
for (var i = 0; i < bodiesLength; i++) {
var body = bodies[i];
if (body.isStatic || body.isSleeping)
if (body.ignoreGravity || body.isStatic || body.isSleeping)
continue;
// add the resultant force of gravity
@ -186691,7 +186890,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BarrelFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -186768,7 +186967,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BloomFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -186925,7 +187124,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BlurFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187068,7 +187267,7 @@ var BlurFXPipeline = new Class({
var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
this.bind(this.activeShader);
this.bind(this.shaders[controller.quality]);
gl.activeTexture(gl.TEXTURE0);
gl.viewport(0, 0, target1.width, target1.height);
@ -187135,7 +187334,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BokehFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187294,7 +187493,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class CircleFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187430,7 +187629,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ColorMatrixFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187505,7 +187704,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class DisplacementFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187627,7 +187826,7 @@ var Utils = __webpack_require__(75512);
* ```
*
* @class GlowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187748,7 +187947,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class GradientFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187790,7 +187989,7 @@ var GradientFXPipeline = new Class({
this.size = 0;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromX
* @type {number}
@ -187799,7 +187998,7 @@ var GradientFXPipeline = new Class({
this.fromX = 0;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromY
* @type {number}
@ -187808,7 +188007,7 @@ var GradientFXPipeline = new Class({
this.fromY = 0;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toX
* @type {number}
@ -187817,7 +188016,7 @@ var GradientFXPipeline = new Class({
this.toX = 0;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toY
* @type {number}
@ -187894,7 +188093,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class PixelateFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187980,7 +188179,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShadowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188118,7 +188317,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShineFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188236,7 +188435,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class VignetteFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188350,7 +188549,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class WipeFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188742,6 +188941,7 @@ module.exports = [
'precision mediump float;',
'uniform sampler2D uMainSampler;',
'uniform vec2 resolution;',
'uniform vec2 offset;',
'uniform float strength;',
'uniform vec3 color;',
'varying vec2 outTexCoord;',
@ -188749,7 +188949,7 @@ module.exports = [
'{',
' vec2 uv = outTexCoord;',
' vec4 col = vec4(0.0);',
' vec2 offset = vec2(1.333) * strength;',
' vec2 offset = vec2(1.333) * offset * strength;',
' col += texture2D(uMainSampler, uv) * 0.29411764705882354;',
' col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;',
' col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;',
@ -203256,7 +203456,7 @@ var WebAudioSoundManager = new Class({
{
if (_this.context && body)
{
var bodyRemove = body.removeEventListener;
var bodyRemove = body.removeEventListener.bind(body);
_this.context.resume().then(function ()
{
@ -211730,7 +211930,7 @@ var TextureManager = new Class({
if (source instanceof Texture)
{
key = texture.key;
key = source.key;
texture = source;
}
else if (this.checkKey(key))
@ -214687,11 +214887,19 @@ var ObjectHelper = new Class({
if (Array.isArray(properties))
{
// Tiled objects custom properties format
properties.forEach(function (propData)
for (var i = 0; i < properties.length; i++)
{
sprite.setData(propData.name, propData.value);
});
var prop = properties[i];
if (sprite[prop.name] !== undefined)
{
sprite[prop.name] = prop.value;
}
else
{
sprite.setData(prop.name, prop.value);
}
}
return;
}
@ -216454,12 +216662,25 @@ var Tilemap = new Class({
* class must have {@link Phaser.GameObjects.Components.Transform#setPosition setPosition} and
* {@link Phaser.GameObjects.Components.Texture#setTexture setTexture} methods.
*
* Custom properties on the Object are copied onto any existing properties on the Game Object, so you can use this as an easy
* way to configure properties from within the map editor. For example giving an Object a
* property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created.
* This method will set the following Tiled Object properties on the new Game Object:
*
* Custom properties that do not exist on the Game Object are set in the
* Game Object's {@link Phaser.GameObjects.GameObject#data data store}.
* - `flippedHorizontal` as `flipX`
* - `flippedVertical` as `flipY`
* - `height` as `displayHeight`
* - `name`
* - `rotation`
* - `visible`
* - `width` as `displayWidth`
* - `x`, adjusted for origin
* - `y`, adjusted for origin
*
* Additionally, this method will set Tiled Object custom properties
*
* - on the Game Object, if it has the same property name and a value that isn't `undefined`; or
* - on the Game Object's {@link Phaser.GameObjects.GameObject#data data store} otherwise.
*
* For example, a Tiled Object with custom properties `{ alpha: 0.5, gold: 1 }` will be created as a Game
* Object with an `alpha` value of 0.5 and a `data.values.gold` value of 1.
*
* When `useTileset` is `true` (the default), Tile Objects will inherit the texture and any tile properties
* from the tileset, and the local tile ID will be used as the texture frame. For the frame selection to work
@ -222496,7 +222717,7 @@ var HexagonalCullBounds = function (layer, camera)
var boundsTop;
var boundsBottom;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
var rowH = ((tileH - len) / 2 + len);
@ -222637,7 +222858,7 @@ var HexagonalGetTileCorners = function (tileX, tileY, camera, layer)
var hexWidth;
var hexHeight;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
hexWidth = b0 * tileWidth;
hexHeight = tileHeight / 2;
@ -222721,7 +222942,7 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
var x;
var y;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
x = worldX + (tileWidth * tileX) + tileWidth;
y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf;
@ -223294,9 +223515,10 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
}
else
{
var tiles = layer.tilemapLayer.tilemap.tiles;
var tilemap = layer.tilemaplayer.tilemap;
var tiles = tilemap.tiles;
var sid = tiles[index][2];
var set = layer.tilemapLayer.tileset[sid];
var set = tilemap.tileset[sid];
newTile.width = set.tileWidth;
newTile.height = set.tileHeight;
@ -225575,6 +225797,17 @@ var LayerData = new Class({
*/
this.name = GetFastValue(config, 'name', 'layer');
/**
* The id of the layer, as specified in the map data.
*
* Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
*
* @name Phaser.Tilemaps.LayerData#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The x offset of where to draw from the top left.
*
@ -226110,6 +226343,15 @@ var ObjectLayer = new Class({
*/
this.name = GetFastValue(config, 'name', 'object layer');
/**
* The id of the object layer, as specified in the map data.
*
* @name Phaser.Tilemaps.ObjectLayer#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The opacity of the layer, between 0 and 1.
*
@ -227562,6 +227804,7 @@ var ParseTileLayers = function (json, insertNull)
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight),
width: curl.width,
@ -227642,6 +227885,7 @@ var ParseTileLayers = function (json, insertNull)
{
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y),
width: curl.width,
@ -233249,7 +233493,10 @@ var BaseTween = new Class({
*/
remove: function ()
{
this.parent.remove(this);
if (this.parent)
{
this.parent.remove(this);
}
return this;
},
@ -233275,7 +233522,7 @@ var BaseTween = new Class({
*/
stop: function ()
{
if (!this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
if (this.parent && !this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
{
this.dispatchEvent(Events.TWEEN_STOP, 'onStop');
@ -239874,12 +240121,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateLeft = function (matrix)
var RotateLeft = function (matrix, amount)
{
return RotateMatrix(matrix, 90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
};
module.exports = RotateLeft;
@ -240009,12 +240264,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateRight = function (matrix)
var RotateRight = function (matrix, amount)
{
return RotateMatrix(matrix, -90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
};
module.exports = RotateRight;

File diff suppressed because one or more lines are too long

435
dist/phaser.js vendored
View file

@ -576,7 +576,7 @@ var GetLast = function (items, compare, index)
{
if (index === undefined) { index = 0; }
for (var i = index; i < items.length; i++)
for (var i = items.length - 1; i >= index; i--)
{
var item = items[i];
@ -6784,7 +6784,7 @@ var AnimationState = new Class({
return;
}
this.accumulator += delta * this.timeScale;
this.accumulator += delta * this.timeScale * this.animationManager.globalTimeScale;
if (this._pendingStop === 1)
{
@ -15679,7 +15679,7 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
VERSION: '3.60.0',
VERSION: '3.61.0-beta.1',
BlendModes: __webpack_require__(95723),
@ -15908,22 +15908,22 @@ var Config = new Class({
/**
* @const {number} Phaser.Core.Config#minWidth - The minimum width, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minWidth = GetValue(scaleConfig, 'minWidth', 0, config);
this.minWidth = GetValue(scaleConfig, 'min.width', 0, config);
/**
* @const {number} Phaser.Core.Config#maxWidth - The maximum width, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxWidth = GetValue(scaleConfig, 'maxWidth', 0, config);
this.maxWidth = GetValue(scaleConfig, 'max.width', 0, config);
/**
* @const {number} Phaser.Core.Config#minHeight - The minimum height, in pixels, the canvas will scale down to. A value of zero means no minimum.
*/
this.minHeight = GetValue(scaleConfig, 'minHeight', 0, config);
this.minHeight = GetValue(scaleConfig, 'min.height', 0, config);
/**
* @const {number} Phaser.Core.Config#maxHeight - The maximum height, in pixels, the canvas will scale up to. A value of zero means no maximum.
*/
this.maxHeight = GetValue(scaleConfig, 'maxHeight', 0, config);
this.maxHeight = GetValue(scaleConfig, 'max.height', 0, config);
/**
* @const {number} Phaser.Core.Config#renderType - Force Phaser to use a specific renderer. Can be `CONST.CANVAS`, `CONST.WEBGL`, `CONST.HEADLESS` or `CONST.AUTO` (default)
@ -31921,7 +31921,7 @@ var Blur = new Class({
* @type {number}
* @since 3.60.0
*/
this.quality = 0;
this.quality = quality;
/**
* The horizontal offset of the blur effect.
@ -32347,8 +32347,28 @@ var Circle = new Class({
color[2] = (value & 0xFF) / 255;
}
}
},
/**
* The alpha of the background, behind the texture, given as a number value.
*
* @name Phaser.FX.Circle#backgroundAlpha
* @type {number}
* @since 3.61.0
*/
backgroundAlpha: {
get: function ()
{
return this.glcolor2[3];
},
set: function (value)
{
this.glcolor2[3] = value;
}
}
});
module.exports = Circle;
@ -32851,10 +32871,10 @@ var FX_CONST = __webpack_require__(47406);
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*/
var Gradient = new Class({
@ -32896,7 +32916,7 @@ var Gradient = new Class({
this.size = size;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromX
* @type {number}
@ -32905,7 +32925,7 @@ var Gradient = new Class({
this.fromX = fromX;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#fromY
* @type {number}
@ -32914,7 +32934,7 @@ var Gradient = new Class({
this.fromY = fromY;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toX
* @type {number}
@ -32923,7 +32943,7 @@ var Gradient = new Class({
this.toX = toX;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.FX.Gradient#toY
* @type {number}
@ -37992,6 +38012,12 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
ty3 = Math.round(ty3);
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
pipeline.batchQuad(src, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit);
}
@ -39678,6 +39704,12 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
continue;
}
if (pipeline.shouldFlush(6))
{
pipeline.flush();
textureUnit = pipeline.setGameObject(src);
}
if (charColors[char.i])
{
var color = charColors[char.i];
@ -42328,10 +42360,10 @@ var FX = new Class({
* @param {number} [color1=0xff0000] - The first gradient color, given as a number value.
* @param {number} [color2=0x00ff00] - The second gradient color, given as a number value.
* @param {number} [alpha=0.2] - The alpha value of the gradient effect.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels.
* @param {number} [fromX=0] - The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [fromY=0] - The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toX=0] - The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [toY=1] - The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels.
* @param {number} [size=0] - How many 'chunks' the gradient is divided in to, as spread over the entire height of the texture. Leave this at zero for a smooth gradient, or set higher for a more retro chunky effect.
*
* @return {Phaser.FX.Gradient} The Gradient FX Controller.
@ -43866,7 +43898,7 @@ var PathFollower = {
{
var tween = this.pathTween;
if (tween)
if (tween && tween.data)
{
var tweenData = tween.data[0];
var pathDelta = this.pathDelta;
@ -54057,6 +54089,16 @@ var Group = new Class({
this.removeCallback = options.removeCallback;
}
if (options.internalCreateCallback)
{
this.internalCreateCallback = options.internalCreateCallback;
}
if (options.internalRemoveCallback)
{
this.internalRemoveCallback = options.internalRemoveCallback;
}
for (var c = 0; c < range.length; c++)
{
var created = this.create(0, 0, range[c].a, range[c].b, visible, active);
@ -61549,7 +61591,7 @@ var EmitterOp = new Class({
// Custom onEmit onUpdate
return 8;
}
else if (this.has(value, 'interpolation'))
else if (this.hasEither(value, 'values', 'interpolation'))
{
// Interpolation
return 9;
@ -62879,12 +62921,15 @@ var Particle = new Class({
this.computeVelocity(emitter, delta, step, processors, t);
this.scaleX = ops.scaleX.onUpdate(this, 'scaleX', t, this.scaleX);
this.scaleY = this.scaleX;
if (ops.scaleY.active)
{
this.scaleY = ops.scaleY.onUpdate(this, 'scaleY', t, this.scaleY);
}
else
{
this.scaleY = this.scaleX;
}
this.angle = ops.rotate.onUpdate(this, 'rotate', t, this.angle);
@ -62898,7 +62943,7 @@ var Particle = new Class({
return true;
}
this.alpha = ops.alpha.onUpdate(this, 'alpha', t, this.alpha);
this.alpha = Clamp(ops.alpha.onUpdate(this, 'alpha', t, this.alpha), 0, 1);
if (ops.color.active)
{
@ -64949,6 +64994,21 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Death Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearDeathZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearDeathZones: function ()
{
this.deathZones.length = 0;
return this;
},
/**
* Adds a new Particle Emission Zone to this Emitter.
*
@ -65042,6 +65102,23 @@ var ParticleEmitter = new Class({
return this;
},
/**
* Clear all Emission Zones from this Particle Emitter.
*
* @method Phaser.GameObjects.Particles.ParticleEmitter#clearEmitZones
* @since 3.61.0
*
* @return {this} This Particle Emitter.
*/
clearEmitZones: function ()
{
this.emitZones.length = 0;
this.zoneIndex = 0;
return this;
},
/**
* Takes the given particle and sets its x/y coordinates to match the next available
* emission zone, if any have been configured. This method is called automatically
@ -66180,7 +66257,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleX
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleX: {
@ -66206,7 +66283,7 @@ var ParticleEmitter = new Class({
* However, it can be set to any valid EmitterOp onEmit type.
*
* @name Phaser.GameObjects.Particles.ParticleEmitter#particleY
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType}
* @type {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType}
* @since 3.60.0
*/
particleY: {
@ -70688,7 +70765,7 @@ var Vector2 = __webpack_require__(93736);
* The Rope object is WebGL only and does not have a Canvas counterpart.
*
* A Rope is a special kind of Game Object that has a texture is stretched along its entire length.
*
*
* Unlike a Sprite, it isn't restricted to using just a quad and can have as many vertices as you define
* when creating it. The vertices can be arranged in a horizontal or vertical strip and have their own
* color and alpha values as well.
@ -70947,6 +71024,7 @@ var Rope = new Class({
this.setPosition(x, y);
this.setSizeToFrame();
this.initPipeline(PIPELINE_CONST.ROPE_PIPELINE);
this.initPostPipeline();
if (Array.isArray(points))
{
@ -80407,6 +80485,11 @@ var GetTextSize = function (text, size, lines)
lineWidth += context.measureText(lines[i]).width;
if (lines[i].length > 1)
{
lineWidth += text.letterSpacing * (lines[i].length - 1);
}
// Adjust for wrapped text
if (style.wordWrap)
{
@ -80832,6 +80915,19 @@ var Text = new Class({
*/
this.lineSpacing = 0;
/**
* Adds / Removes spacing between characters.
* Can be a negative or positive number.
*
* If you update this property directly, instead of using the `setLetterSpacing` method, then
* be sure to call `updateText` after, or you won't see the change reflected in the Text object.
*
* @name Phaser.GameObjects.Text#letterSpacing
* @type {number}
* @since 3.60.0
*/
this.letterSpacing = 0;
/**
* Whether the text or its settings have changed and need updating.
*
@ -81654,6 +81750,32 @@ var Text = new Class({
return this.updateText();
},
/**
* Sets the letter spacing value.
*
* This will add, or remove spacing between each character of this Text Game Object. The value can be
* either positive or negative. Positive values increase the space between each character, whilst negative
* values decrease it. Note that some fonts are spaced naturally closer together than others.
*
* Please understand that enabling this feature will cause Phaser to render each character in this Text object
* one by one, rather than use a draw for the whole string. This makes it extremely expensive when used with
* either long strings, or lots of strings in total. You will be better off creating bitmap font text if you
* need to display large quantities of characters with fine control over the letter spacing.
*
* @method Phaser.GameObjects.Text#setLetterSpacing
* @since 3.61.0
*
* @param {number} value - The amount to add to the letter width. Set to zero to disable.
*
* @return {this} This Text object.
*/
setLetterSpacing: function (value)
{
this.letterSpacing = value;
return this.updateText();
},
/**
* Set the text padding.
*
@ -81735,6 +81857,55 @@ var Text = new Class({
return this.style.setMaxLines(max);
},
/**
* Render text from right-to-left or left-to-right.
*
* @method Phaser.GameObjects.Text#setRTL
* @since 3.61.0
*
* @param {boolean} [rtl=true] - Set to `true` to render from right-to-left.
*
* @return {this} This Text object.
*/
setRTL: function (rtl)
{
if (rtl === undefined) { rtl = true; }
var style = this.style;
if (style.rtl === rtl)
{
return this;
}
style.rtl = rtl;
if (rtl)
{
this.canvas.dir = 'rtl';
this.context.direction = 'rtl';
this.canvas.style.display = 'none';
AddToDOM(this.canvas, this.scene.sys.canvas);
}
else
{
this.canvas.dir = 'ltr';
this.context.direction = 'ltr';
}
if (style.align === 'left')
{
style.align = 'right';
}
else if (style.align === 'right')
{
style.align = 'left';
}
return this;
},
/**
* Update the displayed text.
*
@ -81913,7 +82084,28 @@ var Text = new Class({
{
style.syncShadow(context, style.shadowFill);
context.fillText(lines[i], linePositionX, linePositionY);
// Looping fillText could be an expensive operation, we should ignore it if it is not needed
var letterSpacing = this.letterSpacing;
if (letterSpacing !== 0)
{
var charPositionX = 0;
var line = lines[i].split('');
// Draw text letter by letter
for (var l = 0; l < line.length; l++)
{
context.fillText(line[l], linePositionX + charPositionX, linePositionY);
charPositionX += context.measureText(line[l]).width + letterSpacing;
}
}
else
{
context.fillText(lines[i], linePositionX, linePositionY);
}
}
}
@ -82016,10 +82208,7 @@ var Text = new Class({
*/
preDestroy: function ()
{
if (this.style.rtl)
{
RemoveFromDOM(this.canvas);
}
RemoveFromDOM(this.canvas);
CanvasPool.remove(this.canvas);
@ -135070,12 +135259,6 @@ module.exports = Within;
*/
var Wrap = function (value, min, max)
{
if (value >= min && value <= max)
{
// Skip modulo if already in range
return value;
}
var range = max - min;
return (min + ((((value - min) % range) + range) % range));
@ -143479,17 +143662,16 @@ var PhysicsGroup = new Class({
else if (Array.isArray(children) && IsPlainObject(children[0]))
{
// children is an array of plain objects (i.e., configs)
config = children[0];
var _this = this;
children.forEach(function (singleConfig)
{
singleConfig.internalCreateCallback = _this.createCallbackHandler;
singleConfig.internalRemoveCallback = _this.removeCallbackHandler;
singleConfig.classType = GetFastValue(singleConfig, 'classType', ArcadeSprite);
});
children = null;
config = null;
}
else
{
@ -143520,7 +143702,10 @@ var PhysicsGroup = new Class({
* @since 3.0.0
* @see Phaser.Types.GameObjects.Group.GroupClassTypeConstructor
*/
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
if (config)
{
config.classType = GetFastValue(config, 'classType', ArcadeSprite);
}
/**
* The physics type of the Group's members.
@ -147004,6 +147189,20 @@ var World = new Class({
this.stepsLastFrame++;
},
/**
* Advances the simulation by a single step.
*
* @method Phaser.Physics.Arcade.World#singleStep
* @fires Phaser.Physics.Arcade.Events#WORLD_STEP
* @since 3.61.0
*/
singleStep: function ()
{
this.update(0, this._frameTimeMS);
this.postUpdate();
},
/**
* Updates bodies, draws the debug display, and handles pending queue operations.
*
@ -164785,7 +164984,7 @@ var Body = __webpack_require__(84125);
for (var i = 0; i < bodiesLength; i++) {
var body = bodies[i];
if (body.isStatic || body.isSleeping)
if (body.ignoreGravity || body.isStatic || body.isSleeping)
continue;
// add the resultant force of gravity
@ -186799,7 +186998,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BarrelFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -186876,7 +187075,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BloomFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187033,7 +187232,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BlurFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187176,7 +187375,7 @@ var BlurFXPipeline = new Class({
var currentFBO = gl.getParameter(gl.FRAMEBUFFER_BINDING);
this.bind(this.activeShader);
this.bind(this.shaders[controller.quality]);
gl.activeTexture(gl.TEXTURE0);
gl.viewport(0, 0, target1.width, target1.height);
@ -187243,7 +187442,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class BokehFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187402,7 +187601,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class CircleFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187538,7 +187737,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ColorMatrixFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187613,7 +187812,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class DisplacementFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187735,7 +187934,7 @@ var Utils = __webpack_require__(75512);
* ```
*
* @class GlowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187856,7 +188055,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class GradientFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -187898,7 +188097,7 @@ var GradientFXPipeline = new Class({
this.size = 0;
/**
* The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromX
* @type {number}
@ -187907,7 +188106,7 @@ var GradientFXPipeline = new Class({
this.fromX = 0;
/**
* The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will start from. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#fromY
* @type {number}
@ -187916,7 +188115,7 @@ var GradientFXPipeline = new Class({
this.fromY = 0;
/**
* The horizontal position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The horizontal position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toX
* @type {number}
@ -187925,7 +188124,7 @@ var GradientFXPipeline = new Class({
this.toX = 0;
/**
* The vertical position the gradient will end. This value is noralized, between 0 and 1 and is not in pixels.
* The vertical position the gradient will end. This value is normalized, between 0 and 1 and is not in pixels.
*
* @name Phaser.Renderer.WebGL.Pipelines.FX.GradientFXPipeline#toY
* @type {number}
@ -188002,7 +188201,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class PixelateFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188088,7 +188287,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShadowFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188226,7 +188425,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class ShineFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188344,7 +188543,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class VignetteFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188458,7 +188657,7 @@ var PostFXPipeline = __webpack_require__(80486);
* ```
*
* @class WipeFXPipeline
* @extends Phaser.Renderer.WebGL.WebGLPipeline
* @extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline
* @memberof Phaser.Renderer.WebGL.Pipelines.FX
* @constructor
* @since 3.60.0
@ -188850,6 +189049,7 @@ module.exports = [
'precision mediump float;',
'uniform sampler2D uMainSampler;',
'uniform vec2 resolution;',
'uniform vec2 offset;',
'uniform float strength;',
'uniform vec3 color;',
'varying vec2 outTexCoord;',
@ -188857,7 +189057,7 @@ module.exports = [
'{',
' vec2 uv = outTexCoord;',
' vec4 col = vec4(0.0);',
' vec2 offset = vec2(1.333) * strength;',
' vec2 offset = vec2(1.333) * offset * strength;',
' col += texture2D(uMainSampler, uv) * 0.29411764705882354;',
' col += texture2D(uMainSampler, uv + (offset / resolution)) * 0.35294117647058826;',
' col += texture2D(uMainSampler, uv - (offset / resolution)) * 0.35294117647058826;',
@ -203364,7 +203564,7 @@ var WebAudioSoundManager = new Class({
{
if (_this.context && body)
{
var bodyRemove = body.removeEventListener;
var bodyRemove = body.removeEventListener.bind(body);
_this.context.resume().then(function ()
{
@ -211838,7 +212038,7 @@ var TextureManager = new Class({
if (source instanceof Texture)
{
key = texture.key;
key = source.key;
texture = source;
}
else if (this.checkKey(key))
@ -214795,11 +214995,19 @@ var ObjectHelper = new Class({
if (Array.isArray(properties))
{
// Tiled objects custom properties format
properties.forEach(function (propData)
for (var i = 0; i < properties.length; i++)
{
sprite.setData(propData.name, propData.value);
});
var prop = properties[i];
if (sprite[prop.name] !== undefined)
{
sprite[prop.name] = prop.value;
}
else
{
sprite.setData(prop.name, prop.value);
}
}
return;
}
@ -216562,12 +216770,25 @@ var Tilemap = new Class({
* class must have {@link Phaser.GameObjects.Components.Transform#setPosition setPosition} and
* {@link Phaser.GameObjects.Components.Texture#setTexture setTexture} methods.
*
* Custom properties on the Object are copied onto any existing properties on the Game Object, so you can use this as an easy
* way to configure properties from within the map editor. For example giving an Object a
* property of `alpha: 0.5` in Tiled will be reflected in the Game Object that is created.
* This method will set the following Tiled Object properties on the new Game Object:
*
* Custom properties that do not exist on the Game Object are set in the
* Game Object's {@link Phaser.GameObjects.GameObject#data data store}.
* - `flippedHorizontal` as `flipX`
* - `flippedVertical` as `flipY`
* - `height` as `displayHeight`
* - `name`
* - `rotation`
* - `visible`
* - `width` as `displayWidth`
* - `x`, adjusted for origin
* - `y`, adjusted for origin
*
* Additionally, this method will set Tiled Object custom properties
*
* - on the Game Object, if it has the same property name and a value that isn't `undefined`; or
* - on the Game Object's {@link Phaser.GameObjects.GameObject#data data store} otherwise.
*
* For example, a Tiled Object with custom properties `{ alpha: 0.5, gold: 1 }` will be created as a Game
* Object with an `alpha` value of 0.5 and a `data.values.gold` value of 1.
*
* When `useTileset` is `true` (the default), Tile Objects will inherit the texture and any tile properties
* from the tileset, and the local tile ID will be used as the texture frame. For the frame selection to work
@ -222604,7 +222825,7 @@ var HexagonalCullBounds = function (layer, camera)
var boundsTop;
var boundsBottom;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
var rowH = ((tileH - len) / 2 + len);
@ -222745,7 +222966,7 @@ var HexagonalGetTileCorners = function (tileX, tileY, camera, layer)
var hexWidth;
var hexHeight;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
hexWidth = b0 * tileWidth;
hexHeight = tileHeight / 2;
@ -222829,7 +223050,7 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
var x;
var y;
if (this.staggerAxis === 'y')
if (layer.staggerAxis === 'y')
{
x = worldX + (tileWidth * tileX) + tileWidth;
y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf;
@ -223402,9 +223623,10 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
}
else
{
var tiles = layer.tilemapLayer.tilemap.tiles;
var tilemap = layer.tilemaplayer.tilemap;
var tiles = tilemap.tiles;
var sid = tiles[index][2];
var set = layer.tilemapLayer.tileset[sid];
var set = tilemap.tileset[sid];
newTile.width = set.tileWidth;
newTile.height = set.tileHeight;
@ -225683,6 +225905,17 @@ var LayerData = new Class({
*/
this.name = GetFastValue(config, 'name', 'layer');
/**
* The id of the layer, as specified in the map data.
*
* Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
*
* @name Phaser.Tilemaps.LayerData#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The x offset of where to draw from the top left.
*
@ -226218,6 +226451,15 @@ var ObjectLayer = new Class({
*/
this.name = GetFastValue(config, 'name', 'object layer');
/**
* The id of the object layer, as specified in the map data.
*
* @name Phaser.Tilemaps.ObjectLayer#id
* @type {number}
* @since 3.61.0
*/
this.id = GetFastValue(config, 'id', 0);
/**
* The opacity of the layer, between 0 and 1.
*
@ -227670,6 +227912,7 @@ var ParseTileLayers = function (json, insertNull)
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + layerOffsetX * json.tilewidth),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + layerOffsetY * json.tileheight),
width: curl.width,
@ -227750,6 +227993,7 @@ var ParseTileLayers = function (json, insertNull)
{
layerData = new LayerData({
name: (curGroupState.name + curl.name),
id: curl.id,
x: (curGroupState.x + GetFastValue(curl, 'offsetx', 0) + curl.x),
y: (curGroupState.y + GetFastValue(curl, 'offsety', 0) + curl.y),
width: curl.width,
@ -233357,7 +233601,10 @@ var BaseTween = new Class({
*/
remove: function ()
{
this.parent.remove(this);
if (this.parent)
{
this.parent.remove(this);
}
return this;
},
@ -233383,7 +233630,7 @@ var BaseTween = new Class({
*/
stop: function ()
{
if (!this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
if (this.parent && !this.isRemoved() && !this.isPendingRemove() && !this.isDestroyed())
{
this.dispatchEvent(Events.TWEEN_STOP, 'onStop');
@ -239982,12 +240229,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateLeft = function (matrix)
var RotateLeft = function (matrix, amount)
{
return RotateMatrix(matrix, 90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, 90);
}
return matrix;
};
module.exports = RotateLeft;
@ -240117,12 +240372,20 @@ var RotateMatrix = __webpack_require__(63515);
* @genericUse {T[][]} - [matrix,$return]
*
* @param {T[][]} [matrix] - The array to rotate.
* @param {number} [amount=1] - The number of times to rotate the matrix.
*
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
*/
var RotateRight = function (matrix)
var RotateRight = function (matrix, amount)
{
return RotateMatrix(matrix, -90);
if (amount === undefined) { amount = 1; }
for (var i = 0; i < amount; i++)
{
matrix = RotateMatrix(matrix, -90);
}
return matrix;
};
module.exports = RotateRight;

2
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "phaser",
"version": "3.61.0",
"version": "3.61.0-beta.1",
"release": "Yotsuba",
"description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.",
"author": "Richard Davey <rich@photonstorm.com> (https://www.photonstorm.com)",

View file

@ -20,7 +20,7 @@ var CONST = {
* @type {string}
* @since 3.0.0
*/
VERSION: '3.61.0',
VERSION: '3.61.0-beta.1',
BlendModes: require('./renderer/BlendModes'),