v3.60.0 Beta 20 Release

This commit is contained in:
Richard Davey 2023-03-17 18:24:45 +00:00
parent b1fc05f552
commit e0514a37ac
19 changed files with 204067 additions and 186968 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

743
dist/phaser-ie9.js vendored

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

743
dist/phaser.js vendored

File diff suppressed because it is too large Load diff

2
dist/phaser.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

355
types/phaser.d.ts vendored
View file

@ -1319,7 +1319,7 @@ declare namespace Phaser {
* ```javascript
* this.anims.create({
* key: 'boom',
* frames: this.anims.generateFrameNames('explosion', {
* frames: this.anims.generateFrameNumbers('explosion', {
* start: 0,
* end: 11
* })
@ -1338,7 +1338,7 @@ declare namespace Phaser {
* @param key The key for the texture containing the animation frames.
* @param config The configuration object for the animation frames.
*/
generateFrameNumbers(key: string, config: Phaser.Types.Animations.GenerateFrameNumbers): Phaser.Types.Animations.AnimationFrame[];
generateFrameNumbers(key: string, config?: Phaser.Types.Animations.GenerateFrameNumbers): Phaser.Types.Animations.AnimationFrame[];
/**
* Get an Animation.
@ -2207,16 +2207,16 @@ declare namespace Phaser {
* Example:
*
* If you have a sprite sheet loaded called `explosion` and it contains 12 frames, then you can call this method using:
* `this.anims.generateFrameNumbers('explosion', { start: 0, end: 12 })`.
* `this.anims.generateFrameNumbers('explosion', { start: 0, end: 11 })`.
*
* The `end` value tells it to stop after 12 frames. To create an animation using this method, you can do:
*
* ```javascript
* this.anims.create({
* key: 'boom',
* frames: this.anims.generateFrameNames('explosion', {
* frames: this.anims.generateFrameNumbers('explosion', {
* start: 0,
* end: 12
* end: 11
* })
* });
* ```
@ -2233,7 +2233,7 @@ declare namespace Phaser {
* @param key The key for the texture containing the animation frames.
* @param config The configuration object for the animation frames.
*/
generateFrameNumbers(key: string, config: Phaser.Types.Animations.GenerateFrameNumbers): Phaser.Types.Animations.AnimationFrame[];
generateFrameNumbers(key: string, config?: Phaser.Types.Animations.GenerateFrameNumbers): Phaser.Types.Animations.AnimationFrame[];
/**
* Removes a locally created Animation from this Sprite, based on the given key.
@ -4648,6 +4648,18 @@ declare namespace Phaser {
* The Destroy Camera Event.
*
* This event is dispatched by a Camera instance when it is destroyed by the Camera Manager.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('cameradestroy', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.DESTROY, () => {});
* ```
*/
const DESTROY: string;
@ -4691,6 +4703,18 @@ declare namespace Phaser {
* The Camera Flash Complete Event.
*
* This event is dispatched by a Camera instance when the Flash Effect completes.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('cameraflashcomplete', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.FLASH_COMPLETE, () => {});
* ```
*/
const FLASH_COMPLETE: string;
@ -4698,6 +4722,18 @@ declare namespace Phaser {
* The Camera Flash Start Event.
*
* This event is dispatched by a Camera instance when the Flash Effect starts.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('cameraflashstart', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.FLASH_START, () => {});
* ```
*/
const FLASH_START: string;
@ -4716,6 +4752,18 @@ declare namespace Phaser {
* The Camera Pan Complete Event.
*
* This event is dispatched by a Camera instance when the Pan Effect completes.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerapancomplete', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.PAN_COMPLETE, () => {});
* ```
*/
const PAN_COMPLETE: string;
@ -4723,6 +4771,18 @@ declare namespace Phaser {
* The Camera Pan Start Event.
*
* This event is dispatched by a Camera instance when the Pan Effect starts.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerapanstart', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.PAN_START, () => {});
* ```
*/
const PAN_START: string;
@ -4750,6 +4810,18 @@ declare namespace Phaser {
* The Camera Rotate Complete Event.
*
* This event is dispatched by a Camera instance when the Rotate Effect completes.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerarotatecomplete', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ROTATE_COMPLETE, () => {});
* ```
*/
const ROTATE_COMPLETE: string;
@ -4757,6 +4829,18 @@ declare namespace Phaser {
* The Camera Rotate Start Event.
*
* This event is dispatched by a Camera instance when the Rotate Effect starts.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerarotatestart', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ROTATE_START, () => {});
* ```
*/
const ROTATE_START: string;
@ -4764,6 +4848,18 @@ declare namespace Phaser {
* The Camera Shake Complete Event.
*
* This event is dispatched by a Camera instance when the Shake Effect completes.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerashakecomplete', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.SHAKE_COMPLETE, () => {});
* ```
*/
const SHAKE_COMPLETE: string;
@ -4771,6 +4867,18 @@ declare namespace Phaser {
* The Camera Shake Start Event.
*
* This event is dispatched by a Camera instance when the Shake Effect starts.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerashakestart', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.SHAKE_START, () => {});
* ```
*/
const SHAKE_START: string;
@ -4778,6 +4886,18 @@ declare namespace Phaser {
* The Camera Zoom Complete Event.
*
* This event is dispatched by a Camera instance when the Zoom Effect completes.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerazoomcomplete', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ZOOM_COMPLETE, () => {});
* ```
*/
const ZOOM_COMPLETE: string;
@ -4785,6 +4905,18 @@ declare namespace Phaser {
* The Camera Zoom Start Event.
*
* This event is dispatched by a Camera instance when the Zoom Effect starts.
*
* Listen for it via either of the following:
*
* ```js
* this.cameras.main.on('camerazoomstart', () => {});
* ```
*
* or use the constant, to avoid having to remember the correct event string:
*
* ```js
* this.cameras.main.on(Phaser.Cameras.Scene2D.Events.ZOOM_START, () => {});
* ```
*/
const ZOOM_START: string;
@ -5853,6 +5985,16 @@ declare namespace Phaser {
*/
readonly loaderLocalScheme: string[];
/**
* The quality of the Glow FX (defaults to 0.1)
*/
readonly glowFXQuality: number;
/**
* The distance of the Glow FX (defaults to 10)
*/
readonly glowFXDistance: number;
/**
* An array of global plugins to be installed.
*/
@ -9359,6 +9501,12 @@ declare namespace Phaser {
*/
readonly isStencil: boolean;
/**
* The current stencil level. This can change dynamically at runtime
* and is set in the applyStencil method.
*/
level: boolean;
/**
* Sets a new Graphics object for the Geometry Mask.
* @param graphicsGeometry The Graphics object which will be used for the Geometry Mask.
@ -9765,18 +9913,35 @@ declare namespace Phaser {
}
namespace FX {
/**
* The Barrel FX Controller.
*
* This FX controller manages the barrel distortion effect for a Game Object.
*
* A barrel effect allows you to apply either a 'pinch' or 'expand' distortion to
* a Game Object. The amount of the effect can be modified in real-time.
*
* A Barrel effect is added to a Game Object via the FX component:
*
* ```js
* const sprite = this.add.sprite();
*
* sprite.preFX.addBarrel();
* sprite.postFX.addBarrel();
* ```
*/
class Barrel extends Phaser.FX.Controller {
/**
*
* @param gameObject A reference to the Game Object that has this fx.
* @param amount The amount of distortion applied to the barrel effect. Typically keep this within the range 0 (no distortion) to 1. Default 1.
* @param amount The amount of distortion applied to the barrel effect. A value of 1 is no distortion. Typically keep this within +- 1. Default 1.
*/
constructor(gameObject: Phaser.GameObjects.GameObject, amount?: number);
/**
* The amount of distortion applied to the barrel effect.
*
* Typically keep this within the range 0 (no distortion) to 1.
* Typically keep this within the range 1 (no distortion) to +- 1.
*/
amount: number;
@ -10139,27 +10304,35 @@ declare namespace Phaser {
}
/**
* The Glow FX Controller.
*
* This FX controller manages the glow effect for a Game Object.
*
* A glow effect allows you to apply a soft, blurred 'glow' around either the outside,
* inside, or both of a Game Object. The color and strength of the glow can be modified.
*
* You can modify most of its properties in real-time to adjust the visual effect.
*
* A Glow effect is added to a Game Object via the FX component:
*
* ```js
* const sprite = this.add.sprite();
*
* sprite.preFX.addGlow();
* sprite.postFX.addGlow();
* ```
*/
class Glow extends Phaser.FX.Controller {
/**
*
* @param gameObject A reference to the Game Object that has this fx.
* @param color The color of the glow effect as a number value. Default 0xffffff.
* @param distance The distance of the glow. This must be an integer and can be between 0 and 128 inclusive. Default 16.
* @param outerStrength The strength of the glow outward from the edge of the Sprite. Default 4.
* @param innerStrength The strength of the glow inward from the edge of the Sprite. Default 0.
* @param knockout If `true` only the glow is drawn, not the texture itself. Default false.
*/
constructor(gameObject: Phaser.GameObjects.GameObject, color?: number, distance?: number, outerStrength?: number, innerStrength?: number, knockout?: boolean);
/**
* The distance of the glow.
*
* This must be an integer and can be between 0 and 128 inclusive.
*
* The higher the value, the more iterations the shader takes
* when drawing the glow.
*/
distance: number;
constructor(gameObject: Phaser.GameObjects.GameObject, color?: number, outerStrength?: number, innerStrength?: number, knockout?: boolean);
/**
* The strength of the glow outward from the edge of the Sprite.
@ -14302,17 +14475,19 @@ declare namespace Phaser {
* on-top of each other. If you don't want this, make sure to call either `remove` or
* `clear` first.
* @param fx The FX Controller to add to this FX Component.
* @param config Optional configuration object that is passed to the pipeline during instantiation.
*/
add(fx: Phaser.FX.Controller): Phaser.FX.Controller;
add(fx: Phaser.FX.Controller, config?: object): Phaser.FX.Controller;
/**
* Adds a Glow effect.
* @param color The color of the glow effect as a number value. Default 0xffffff.
* @param distance The distance of the glow. This must be an integer and can be between 0 and 128 inclusive. Default 16.
* @param outerStrength The strength of the glow outward from the edge of the Sprite. Default 4.
* @param innerStrength The strength of the glow inward from the edge of the Sprite. Default 0.
* @param knockout If `true` only the glow is drawn, not the texture itself. Default false.
* @param quality Only available for PostFX. Sets the quality of this Glow effect. Default is 0.1. Cannot be changed post-creation. Default 0.1.
* @param distance Only available for PostFX. Sets the distance of this Glow effect. Default is 10. Cannot be changed post-creation. Default 10.
*/
addGlow(color?: number, distance?: number, outerStrength?: number, innerStrength?: number, knockout?: boolean): Phaser.FX.Glow;
addGlow(color?: number, outerStrength?: number, innerStrength?: number, knockout?: boolean, quality?: number, distance?: number): Phaser.FX.Glow;
/**
* Adds a Shadow effect.
* @param x The horizontal offset of the shadow effect. Default 0.
@ -14392,7 +14567,7 @@ declare namespace Phaser {
addCircle(thickness?: number, color?: number, backgroundColor?: number, scale?: number, feather?: number): Phaser.FX.Circle;
/**
* Adds a Barrel effect.
* @param amount The amount of distortion applied to the barrel effect. Typically keep this within the range 0 (no distortion) to 1. Default 1.
* @param amount The amount of distortion applied to the barrel effect. A value of 1 is no distortion. Typically keep this within +- 1. Default 1.
*/
addBarrel(amount?: number): Phaser.FX.Barrel;
/**
@ -65075,6 +65250,10 @@ declare namespace Phaser {
/**
* The value of PI * 0.5.
*
* Yes, we undertstand that this should actually be PI * 2, but
* it has been like this for so long we can't change it now.
* If you need PI * 2, use the PI2 constant instead.
*/
var TAU: number;
@ -79769,7 +79948,8 @@ declare namespace Phaser {
customBoundsRectangle: Phaser.Geom.Rectangle;
/**
* Whether the simulation emits a `worldbounds` event when this Body collides with the world boundary (and `collideWorldBounds` is also true).
* Whether the simulation emits a `worldbounds` event when this Body collides with the world boundary
* (and `collideWorldBounds` is also true).
*/
onWorldBounds: boolean;
@ -79784,7 +79964,7 @@ declare namespace Phaser {
onOverlap: boolean;
/**
* The Body's absolute maximum velocity, in pixels per second.
* The absolute maximum velocity of this body, in pixels per second.
* The horizontal and vertical components are applied separately.
*/
maxVelocity: Phaser.Math.Vector2;
@ -89639,8 +89819,9 @@ declare namespace Phaser {
* If no instance, or matching name, exists in this manager, it returns `undefined`.
* @param pipeline Either the string-based name of the pipeline to get, or a pipeline instance, or class to look-up.
* @param gameObject If this post pipeline is being installed into a Game Object or Camera, this is a reference to it.
* @param config Optional pipeline data object that is set in to the `postPipelineData` property of this Game Object.
*/
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline, gameObject?: Phaser.GameObjects.GameObject): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline;
getPostPipeline(pipeline: string | Function | Phaser.Renderer.WebGL.Pipelines.PostFXPipeline, gameObject?: Phaser.GameObjects.GameObject, config?: object): Phaser.Renderer.WebGL.Pipelines.PostFXPipeline;
/**
* Removes a pipeline instance based on the given name.
@ -90083,6 +90264,82 @@ declare namespace Phaser {
}
namespace FX {
/**
* The Barrel FX Pipeline.
*
* A barrel effect allows you to apply either a 'pinch' or 'expand' distortion to
* a Game Object. The amount of the effect can be modified in real-time.
*
* A Barrel effect is added to a Game Object via the FX component:
*
* ```js
* const sprite = this.add.sprite();
*
* sprite.postFX.addBarrel();
* ```
*/
class BarrelFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
/**
*
* @param game A reference to the Phaser Game instance.
*/
constructor(game: Phaser.Game);
/**
* The amount of distortion applied to the barrel effect.
*
* Typically keep this within the range 1 (no distortion) to +- 1.
*/
amount: number;
}
/**
* The Glow FX Pipeline.
*
* A glow effect allows you to apply a soft, blurred 'glow' around either the outside,
* inside, or both of a Game Object. The color and strength of the glow can be modified.
*
* You can modify most of its properties in real-time to adjust the visual effect.
*
* A Glow effect is added to a Game Object via the FX component:
*
* ```js
* const sprite = this.add.sprite();
*
* sprite.postFX.addGlow();
* ```
*/
class GlowFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline {
/**
*
* @param game A reference to the Phaser Game instance.
* @param config The configuration options for this pipeline.
*/
constructor(game: Phaser.Game, config: object);
/**
* The strength of the glow outward from the edge of the Sprite.
*/
outerStrength: number;
/**
* The strength of the glow inward from the edge of the Sprite.
*/
innerStrength: number;
/**
* If `true` only the glow is drawn, not the texture itself.
*/
knockout: number;
/**
* A 4 element array of gl color values.
*/
glcolor: number[];
}
}
class FXPipeline extends Phaser.Renderer.WebGL.Pipelines.PreFXPipeline {
@ -90648,7 +90905,7 @@ declare namespace Phaser {
* If this Post Pipeline belongs to a Game Object or Camera,
* this property contains a reference to it.
*/
gameObject: Phaser.GameObjects.GameObject;
gameObject: Phaser.GameObjects.GameObject | Phaser.Cameras.Scene2D.Camera;
/**
* If this Post Pipeline belongs to an FX Controller, this is a
@ -91575,6 +91832,11 @@ declare namespace Phaser {
*/
readonly autoResize: boolean;
/**
* Does this Render Target have a Depth Buffer?
*/
readonly hasDepthBuffer: boolean;
/**
* Sets if this Render Target should automatically resize when the WebGL Renderer
* emits a resize event.
@ -91687,6 +91949,16 @@ declare namespace Phaser {
*/
function parseFragmentShaderMaxTextures(fragmentShaderSource: string, maxTextures: number): string;
/**
* Takes the Glow FX Shader source and parses out the __SIZE__ and __DIST__
* consts with the configuration values.
* @param shader The Fragment Shader source code to operate on.
* @param game The Phaser Game instance.
* @param quality The quality of the glow (defaults to 0.1)
* @param distance The distance of the glow (defaults to 10)
*/
function setGlowQuality(shader: string, game: Phaser.Game, quality?: number, distance?: number): string;
}
/**
@ -93253,8 +93525,10 @@ declare namespace Phaser {
* @param framebuffer The framebuffer that needs to be bound.
* @param updateScissor Set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. Default false.
* @param setViewport Should the WebGL viewport be set? Default true.
* @param texture Bind the given frame buffer texture? Default null.
* @param clear Clear the frame buffer after binding? Default false.
*/
pushFramebuffer(framebuffer: WebGLFramebuffer, updateScissor?: boolean, setViewport?: boolean): this;
pushFramebuffer(framebuffer: WebGLFramebuffer, updateScissor?: boolean, setViewport?: boolean, texture?: WebGLTexture, clear?: boolean): this;
/**
* Sets the given framebuffer as the active and currently bound framebuffer.
@ -93265,8 +93539,10 @@ declare namespace Phaser {
* @param framebuffer The framebuffer that needs to be bound.
* @param updateScissor If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. Default false.
* @param setViewport Should the WebGL viewport be set? Default true.
* @param texture Bind the given frame buffer texture? Default null.
* @param clear Clear the frame buffer after binding? Default false.
*/
setFramebuffer(framebuffer: WebGLFramebuffer, updateScissor?: boolean, setViewport?: boolean): this;
setFramebuffer(framebuffer: WebGLFramebuffer, updateScissor?: boolean, setViewport?: boolean, texture?: WebGLTexture, clear?: boolean): this;
/**
* Pops the previous framebuffer from the fbo stack and sets it.
@ -93275,6 +93551,13 @@ declare namespace Phaser {
*/
popFramebuffer(updateScissor?: boolean, setViewport?: boolean): WebGLFramebuffer;
/**
* Restores the previous framebuffer from the fbo stack and sets it.
* @param updateScissor If a framebuffer is given, set the gl scissor to match the frame buffer size? Or, if `null` given, pop the scissor from the stack. Default false.
* @param setViewport Should the WebGL viewport be set? Default true.
*/
restoreFramebuffer(updateScissor?: boolean, setViewport?: boolean): void;
/**
* Binds a shader program.
*
@ -93433,6 +93716,18 @@ declare namespace Phaser {
*/
postRender(): void;
/**
* Disables the STENCIL_TEST but does not change the status
* of the current stencil mask.
*/
clearStencilMask(): void;
/**
* Restores the current stencil function to the one that was in place
* before `clearStencilMask` was called.
*/
restoreStencilMask(): void;
/**
* Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered.
*