diff --git a/README.md b/README.md index dca48fc20b..93e939c3e9 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ Grab the source and join the fun!
-> 13th May 2022 +> 7th June 2022 -We've been quietly but solidly working away on Phaser 3.60 for months now and are very close to release. Today I'm happy to say that 3.60 Beta 8 has been published and I would urge you to test it, if you can do so. It should be a safe drop-in replacement for Phaser 3.55, with very little need for changes to your code. However, it does bring a lot of new features and fixes to the table. +We've been quietly but solidly working away on Phaser 3.60 for months now and are very close to release. Today I'm happy to say that 3.60 Beta 9 has been published and I would urge you to test it, if you can do so. It should be a safe drop-in replacement for Phaser 3.55, with very little need for changes to your code. However, it does bring a lot of new features and fixes to the table. Some of the new features include: @@ -44,10 +44,10 @@ There are also hundreds of updates and bug fixes across the entire codebase. As always, I have been careful to record all of these in their own [Change Log](https://github.com/photonstorm/phaser/blob/master/CHANGELOG-v3.60.md). So it's easier for you to identify which change happened in the 3.60 version specifically. -Beta 8 is available now from the [Releases page](https://github.com/photonstorm/phaser/releases). You can also download it from npm: +Beta 9 is available now from the [Releases page](https://github.com/photonstorm/phaser/releases). You can also download it from npm: ``` -npm i phaser@3.60.0-beta.8 +npm i phaser@3.60.0-beta.9 ``` I have published new TypeScript defs files that align with this version. You can find them in the `types` folder of this repository. @@ -84,8 +84,7 @@ We use [Patreon](https://www.patreon.com/photonstorm) to manage the backing and You can also support us by using crypto currencies. The Phaser wallet addresses are: -* Ethereum: 0x10412d654b44570950631aA0C3E3f3aFcAEfAB4C -* Bitcoin: 3MjS5iNH8yUBfYW2emxBk7rRUkP6ncrkXC +* Ethereum: 0x6a716A122Ad186ECE865C55D16c1D361f1B13724 * BSC / AVAX / Polygon: 0x94aC3F640b8749AbD1d44f29A62ffeB32CA34628 Extra special thanks to the following companies whose support makes Phaser possible: diff --git a/types/phaser.d.ts b/types/phaser.d.ts index bdb9a34903..a2c72f01b2 100644 --- a/types/phaser.d.ts +++ b/types/phaser.d.ts @@ -10221,6 +10221,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -11421,6 +11426,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -12179,6 +12189,11 @@ declare namespace Phaser { */ setFrame(frame: string | number, updateSize?: boolean, updateOrigin?: boolean): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -12895,7 +12910,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -12905,7 +12920,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -13655,6 +13670,10 @@ declare namespace Phaser { * Provides methods used for getting and setting the position, scale and rotation of a Game Object. */ interface Transform { + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; /** * The x position of this Game Object. */ @@ -14989,6 +15008,11 @@ declare namespace Phaser { */ getPipelineName(): string; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -15895,6 +15919,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -16774,6 +16803,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -19293,6 +19327,11 @@ declare namespace Phaser { */ getPipelineName(): string; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -20328,7 +20367,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -20339,7 +20378,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -20988,6 +21027,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -21923,8 +21967,12 @@ declare namespace Phaser { * Any Game Objects using the Light2D pipeline will then be affected by these Lights as long as they have a normal map. * * They can also simply be used to represent a point light for your own purposes. + * + * As of Phaser 3.60 this Game Object now has the Transform and Origin components. However, changing the scale, + * rotation or origin properties will not make any difference to the Light. They are simply present to allow you + * to add this Light to a Container, or enable it for Physics. */ - class Light extends Phaser.Geom.Circle implements Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Visible { + class Light extends Phaser.Geom.Circle implements Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible { /** * * @param x The horizontal position of the light. @@ -21961,6 +22009,26 @@ declare namespace Phaser { */ cameraFilter: number; + /** + * The width of this Light Game Object. This is the same as `Light.diameter`. + */ + displayWidth: number; + + /** + * The height of this Light Game Object. This is the same as `Light.diameter`. + */ + displayHeight: number; + + /** + * The width of this Light Game Object. This is the same as `Light.diameter`. + */ + width: number; + + /** + * The height of this Light Game Object. This is the same as `Light.diameter`. + */ + height: number; + /** * Compares the renderMask with the renderFlags to see if this Game Object will render or not. * Also checks the Game Object against the given Cameras exclusion list. @@ -21991,6 +22059,64 @@ declare namespace Phaser { */ static readonly RENDER_MASK: number; + /** + * The horizontal origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the left of the Game Object. + */ + originX: number; + + /** + * The vertical origin of this Game Object. + * The origin maps the relationship between the size and position of the Game Object. + * The default value is 0.5, meaning all Game Objects are positioned based on their center. + * Setting the value to 0 means the position now relates to the top of the Game Object. + */ + originY: number; + + /** + * The horizontal display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + */ + displayOriginX: number; + + /** + * The vertical display origin of this Game Object. + * The origin is a normalized value between 0 and 1. + * The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin. + */ + displayOriginY: number; + + /** + * Sets the origin of this Game Object. + * + * The values are given in the range 0 to 1. + * @param x The horizontal origin value. Default 0.5. + * @param y The vertical origin value. If not defined it will be set to the value of `x`. Default x. + */ + setOrigin(x?: number, y?: number): this; + + /** + * Sets the origin of this Game Object based on the Pivot values in its Frame. + */ + setOriginFromFrame(): this; + + /** + * Sets the display origin of this Game Object. + * The difference between this and setting the origin is that you can use pixel values for setting the display origin. + * @param x The horizontal display origin value. Default 0. + * @param y The vertical display origin value. If not defined it will be set to the value of `x`. Default x. + */ + setDisplayOrigin(x?: number, y?: number): this; + + /** + * Updates the Display Origin cached values internally stored on this Game Object. + * You don't usually call this directly, but it is exposed for edge-cases where you may. + */ + updateDisplayOrigin(): this; + /** * The horizontal scroll factor of this Game Object. * @@ -22050,6 +22176,166 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + + /** + * The z position of this Game Object. + * + * Note: The z position does not control the rendering order of 2D Game Objects. Use + * {@link Phaser.GameObjects.Components.Depth#depth} instead. + */ + z: number; + + /** + * The w position of this Game Object. + */ + w: number; + + /** + * This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object + * to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`. + * + * Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this + * isn't the case, use the `scaleX` or `scaleY` properties instead. + */ + scale: number; + + /** + * The horizontal scale of this Game Object. + */ + scaleX: number; + + /** + * The vertical scale of this Game Object. + */ + scaleY: number; + + /** + * The angle of this Game Object as expressed in degrees. + * + * Phaser uses a right-hand clockwise rotation system, where 0 is right, 90 is down, 180/-180 is left + * and -90 is up. + * + * If you prefer to work in radians, see the `rotation` property instead. + */ + angle: number; + + /** + * The angle of this Game Object in radians. + * + * Phaser uses a right-hand clockwise rotation system, where 0 is right, PI/2 is down, +-PI is left + * and -PI/2 is up. + * + * If you prefer to work in degrees, see the `angle` property instead. + */ + rotation: number; + + /** + * Copies an object's coordinates to this Game Object's position. + * @param source An object with numeric 'x', 'y', 'z', or 'w' properties. Undefined values are not copied. + */ + copyPosition(source: Phaser.Types.Math.Vector2Like | Phaser.Types.Math.Vector3Like | Phaser.Types.Math.Vector4Like): this; + + /** + * Sets the position of this Game Object to be a random position within the confines of + * the given area. + * + * If no area is specified a random position between 0 x 0 and the game width x height is used instead. + * + * The position does not factor in the size of this Game Object, meaning that only the origin is + * guaranteed to be within the area. + * @param x The x position of the top-left of the random area. Default 0. + * @param y The y position of the top-left of the random area. Default 0. + * @param width The width of the random area. + * @param height The height of the random area. + */ + setRandomPosition(x?: number, y?: number, width?: number, height?: number): this; + + /** + * Sets the rotation of this Game Object. + * @param radians The rotation of this Game Object, in radians. Default 0. + */ + setRotation(radians?: number): this; + + /** + * Sets the angle of this Game Object. + * @param degrees The rotation of this Game Object, in degrees. Default 0. + */ + setAngle(degrees?: number): this; + + /** + * Sets the scale of this Game Object. + * @param x The horizontal scale of this Game Object. + * @param y The vertical scale of this Game Object. If not set it will use the `x` value. Default x. + */ + setScale(x: number, y?: number): this; + + /** + * Sets the x position of this Game Object. + * @param value The x position of this Game Object. Default 0. + */ + setX(value?: number): this; + + /** + * Sets the y position of this Game Object. + * @param value The y position of this Game Object. Default 0. + */ + setY(value?: number): this; + + /** + * Sets the z position of this Game Object. + * + * Note: The z position does not control the rendering order of 2D Game Objects. Use + * {@link Phaser.GameObjects.Components.Depth#setDepth} instead. + * @param value The z position of this Game Object. Default 0. + */ + setZ(value?: number): this; + + /** + * Sets the w position of this Game Object. + * @param value The w position of this Game Object. Default 0. + */ + setW(value?: number): this; + + /** + * Gets the local transform matrix for this Game Object. + * @param tempMatrix The matrix to populate with the values from this Game Object. + */ + getLocalTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix; + + /** + * Gets the world transform matrix for this Game Object, factoring in any parent Containers. + * @param tempMatrix The matrix to populate with the values from this Game Object. + * @param parentMatrix A temporary matrix to hold parent values during the calculations. + */ + getWorldTransformMatrix(tempMatrix?: Phaser.GameObjects.Components.TransformMatrix, parentMatrix?: Phaser.GameObjects.Components.TransformMatrix): Phaser.GameObjects.Components.TransformMatrix; + + /** + * Takes the given `x` and `y` coordinates and converts them into local space for this + * Game Object, taking into account parent and local transforms, and the Display Origin. + * + * The returned Vector2 contains the translated point in its properties. + * + * A Camera needs to be provided in order to handle modified scroll factors. If no + * camera is specified, it will use the `main` camera from the Scene to which this + * Game Object belongs. + * @param x The x position to translate. + * @param y The y position to translate. + * @param point A Vector2, or point-like object, to store the results in. + * @param camera The Camera which is being tested against. If not given will use the Scene default camera. + */ + getLocalPoint(x: number, y: number, point?: Phaser.Math.Vector2, camera?: Phaser.Cameras.Scene2D.Camera): Phaser.Math.Vector2; + + /** + * Gets the sum total rotation of all of this Game Objects parent Containers. + * + * The returned value is in radians and will be zero if this Game Object has no parent container. + */ + getParentRotation(): number; + /** * The visible state of the Game Object. * @@ -23165,6 +23451,11 @@ declare namespace Phaser { */ setFrame(frame: string | number, updateSize?: boolean, updateOrigin?: boolean): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -24978,6 +25269,11 @@ declare namespace Phaser { */ getPipelineName(): string; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -25564,7 +25860,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -25575,7 +25871,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -26224,6 +26520,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -26960,6 +27261,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -27162,6 +27468,10 @@ declare namespace Phaser { * that when drawing objects such as Shapes to a Render Texture they will appear to be drawn with no aliasing, however this * is a technical limitation of WebGL. To get around it, create your shape as a texture in an art package, then draw that * to the Render Texture. + * + * If you are planning on using this Render Texture as a base texture for Sprite + * Game Objects, then you should set `RenderTexture.isSpriteTexture = true` _before_ + * calling any `draw` methods, otherwise you will get inverted frames in WebGL. */ class RenderTexture extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Crop, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.FX, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Tint, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible { /** @@ -27216,6 +27526,16 @@ declare namespace Phaser { */ frame: Phaser.Textures.Frame; + /** + * Is this Render Texture being used as the base texture for a Sprite Game Object? + * + * If so, you should enable this property _prior_ to drawing to it, so that it correctly + * inverses the frames for WebGL rendering. Not doing so will result in inverted frames. + * + * You can also toggle this property at run-time. It it used in the `endDraw` method. + */ + isSpriteTexture: boolean; + /** * A reference to the Rendering Context belonging to the Canvas Element this Render Texture is drawing to. */ @@ -27244,6 +27564,14 @@ declare namespace Phaser { */ setSize(width: number, height: number): this; + /** + * If you are planning on using this Render Texture as a base texture for Sprite + * Game Objects, then you should call this method with a value of `true` before + * calling drawing anything to it, otherwise you will get inverted frames in WebGL. + * @param value Is this Render Target being used as a Sprite Texture, or not? + */ + setIsSpriteTexture(value: boolean): this; + /** * Resizes the Render Texture to the new dimensions given. * @@ -27408,6 +27736,10 @@ declare namespace Phaser { * after the entries have been iterated. So if you've a bunch of objects to draw, * try and pass them in an array in one single call, rather than making lots of * separate calls. + * + * If you are planning on using this Render Texture as a base texture for Sprite + * Game Objects, then you should set `RenderTexture.isSpriteTexture = true` before + * calling this method, otherwise you will get inverted frames in WebGL. * @param entries Any renderable Game Object, or Group, Container, Display List, other Render Texture, Texture Frame or an array of any of these. * @param x The x position to draw the Frame at, or the offset applied to the object. * @param y The y position to draw the Frame at, or the offset applied to the object. @@ -27433,6 +27765,10 @@ declare namespace Phaser { * in a tight loop, try using the `draw` method instead. * * If you need to draw a Sprite to this Render Texture, use the `draw` method instead. + * + * If you are planning on using this Render Texture as a base texture for Sprite + * Game Objects, then you should set `RenderTexture.isSpriteTexture = true` before + * calling this method, otherwise you will get inverted frames in WebGL. * @param key The key of the texture to be used, as stored in the Texture Manager. * @param frame The name or index of the frame within the Texture. * @param x The x position to draw the frame at. Default 0. @@ -27964,7 +28300,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -27975,7 +28311,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -28480,6 +28816,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -29445,6 +29786,11 @@ declare namespace Phaser { */ setFrame(frame: string | number, updateSize?: boolean, updateOrigin?: boolean): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -30393,6 +30739,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -31143,6 +31494,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -31846,6 +32202,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -32559,6 +32920,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -33342,6 +33708,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -34092,6 +34463,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -34856,6 +35232,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -35576,6 +35957,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -36277,6 +36663,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -36971,6 +37362,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -37790,6 +38186,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -38517,6 +38918,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -39218,6 +39624,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -39865,7 +40276,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -39876,7 +40287,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -40525,6 +40936,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -41416,7 +41832,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -41427,7 +41843,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -41932,6 +42348,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -42957,7 +43378,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -42968,7 +43389,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -43473,6 +43894,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -44418,7 +44844,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -44429,7 +44855,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -45078,6 +45504,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -45522,6 +45953,11 @@ declare namespace Phaser { */ updateDisplayOrigin(): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -51455,7 +51891,8 @@ declare namespace Phaser { * Scene to stop all input, or `this.input.keyboard.preventDefault = false` to stop a Scene halting input on another Scene. * * _Note_: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. - * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details. + * See http://www.html5gamedevs.com/topic/4876-impossible-to-use-more-than-2-keyboard-input-buttons-at-the-same-time/ for more details + * and use the site https://w3c.github.io/uievents/tools/key-event-viewer.html to test your n-key support in browser. * * Also please be aware that certain browser extensions can disable or override Phaser keyboard handling. * For example the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. @@ -68725,7 +69162,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -68736,7 +69173,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -69385,6 +69822,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -69974,11 +70416,11 @@ declare namespace Phaser { * Tests if Game Objects overlap. See {@link Phaser.Physics.Arcade.World#overlap} * @param object1 The first object or array of objects to check. * @param object2 The second object or array of objects to check, or `undefined`. - * @param collideCallback An optional callback function that is called if the objects collide. + * @param overlapCallback An optional callback function that is called if the objects overlap. * @param processCallback An optional callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param callbackContext The context in which to run the callbacks. */ - overlap(object1: Phaser.Types.Physics.Arcade.ArcadeColliderType, object2?: Phaser.Types.Physics.Arcade.ArcadeColliderType, collideCallback?: Phaser.Types.Physics.Arcade.ArcadePhysicsCallback, processCallback?: Phaser.Types.Physics.Arcade.ArcadePhysicsCallback, callbackContext?: any): boolean; + overlap(object1: Phaser.Types.Physics.Arcade.ArcadeColliderType, object2?: Phaser.Types.Physics.Arcade.ArcadeColliderType, overlapCallback?: Phaser.Types.Physics.Arcade.ArcadePhysicsCallback, processCallback?: Phaser.Types.Physics.Arcade.ArcadePhysicsCallback, callbackContext?: any): boolean; /** * Performs a collision check and separation between the two physics enabled objects given, which can be single @@ -70432,7 +70874,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -70443,7 +70885,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -71092,6 +71534,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -74045,6 +74492,11 @@ declare namespace Phaser { */ treeMinMax: Phaser.Types.Physics.Arcade.ArcadeWorldTreeMinMax; + /** + * The Filtering Options passed to `GetTilesWithinWorldXY` as part of the `collideSpriteVsTilemapLayer` check. + */ + tileFilterOptions: Phaser.Types.Tilemaps.FilteringOptions; + /** * Adds an Arcade Physics Body to a Game Object, an array of Game Objects, or the children of a Group. * @@ -76047,7 +76499,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -76058,7 +76510,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -76707,6 +77159,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -78020,7 +78477,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. */ @@ -78031,7 +78488,7 @@ declare namespace Phaser { * when it is being rendered by a SpriteFX Pipeline. * * Lots of FX require additional spacing added to the texture the - * Game Object uses, for example a glow or shaddow effect, and this + * Game Object uses, for example a glow or shadow effect, and this * method allows you to control how much extra padding is included * in addition to the texture size. * @param padding The amount of padding to add to the texture. Default 0. @@ -78680,6 +79137,11 @@ declare namespace Phaser { */ readonly isTinted: boolean; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */ @@ -83268,8 +83730,9 @@ declare namespace Phaser { * @param clear Clear the target before copying? Default true. * @param clearAlpha Clear the alpha channel when running `gl.clear` on the target? Default true. * @param eraseMode Erase source from target using ERASE Blend Mode? Default false. + * @param flipY Flip the UV on the Y axis before drawing? Default false. */ - blitFrame(source: Phaser.Renderer.WebGL.RenderTarget, target: Phaser.Renderer.WebGL.RenderTarget, brightness?: number, clear?: boolean, clearAlpha?: boolean, eraseMode?: boolean): void; + blitFrame(source: Phaser.Renderer.WebGL.RenderTarget, target: Phaser.Renderer.WebGL.RenderTarget, brightness?: number, clear?: boolean, clearAlpha?: boolean, eraseMode?: boolean, flipY?: boolean): void; /** * Binds the `source` Render Target and then copies a section of it to the `target` Render Target. @@ -90106,6 +90569,24 @@ declare namespace Phaser { */ checkQueue: boolean; + /** + * Checks the given item to see if it is already active within this Process Queue. + * @param item The item to check. + */ + isActive(item: T): Phaser.Structs.ProcessQueue; + + /** + * Checks the given item to see if it is already pending addition to this Process Queue. + * @param item The item to check. + */ + isPending(item: T): Phaser.Structs.ProcessQueue; + + /** + * Checks the given item to see if it is already pending destruction from this Process Queue. + * @param item The item to check. + */ + isDestroying(item: T): Phaser.Structs.ProcessQueue; + /** * Adds a new item to the Process Queue. * @@ -90117,7 +90598,7 @@ declare namespace Phaser { /** * Removes an item from the Process Queue. * - * The item is added to the pending destroy and fully removed in the next update. + * The item is added to the 'destroy' list and is fully removed in the next update. * @param item The item to be removed from the queue. */ remove(item: T): Phaser.Structs.ProcessQueue; @@ -94954,7 +95435,7 @@ declare namespace Phaser { * A Tilemap Layer is a Game Object that renders LayerData from a Tilemap when used in combination * with one, or more, Tilesets. */ - class TilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible { + class TilemapLayer extends Phaser.GameObjects.GameObject implements Phaser.GameObjects.Components.Alpha, Phaser.GameObjects.Components.BlendMode, Phaser.GameObjects.Components.ComputedSize, Phaser.GameObjects.Components.Depth, Phaser.GameObjects.Components.Flip, Phaser.GameObjects.Components.GetBounds, Phaser.GameObjects.Components.Mask, Phaser.GameObjects.Components.Origin, Phaser.GameObjects.Components.Pipeline, Phaser.GameObjects.Components.ScrollFactor, Phaser.GameObjects.Components.Transform, Phaser.GameObjects.Components.Visible { /** * * @param scene The Scene to which this Game Object belongs. @@ -95205,6 +95686,26 @@ declare namespace Phaser { */ forEachTile(callback: EachTileCallback, context?: object, tileX?: number, tileY?: number, width?: number, height?: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): this; + /** + * Sets an additive tint on each Tile within the given area. + * + * The tint works by taking the pixel color values from the tileset texture, and then + * multiplying it by the color value of the tint. + * + * If no area values are given then all tiles will be tinted to the given color. + * + * To remove a tint call this method with either no parameters, or by passing white `0xffffff` as the tint color. + * + * If a tile already has a tint set then calling this method will override that. + * @param tint The tint color being applied to each tile within the region. Given as a hex value, i.e. `0xff0000` for red. Set to white (`0xffffff`) to reset the tint. Default 0xffffff. + * @param tileX The left most tile index (in tile coordinates) to use as the origin of the area to search. + * @param tileY The top most tile index (in tile coordinates) to use as the origin of the area to search. + * @param width How many tiles wide from the `tileX` index the area will be. + * @param height How many tiles tall from the `tileY` index the area will be. + * @param filteringOptions Optional filters to apply when getting the tiles. + */ + setTint(tint?: number, tileX?: number, tileY?: number, width?: number, height?: number, filteringOptions?: Phaser.Types.Tilemaps.FilteringOptions): this; + /** * Gets a tile at the given tile coordinates from the given layer. * @param tileX X position to get the tile from (given in tile units, not pixels). @@ -95904,6 +96405,65 @@ declare namespace Phaser { */ getBounds(output?: O): O; + /** + * The Mask this Game Object is using during render. + */ + mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask; + + /** + * Sets the mask that this Game Object will use to render with. + * + * The mask must have been previously created and can be either a GeometryMask or a BitmapMask. + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * + * If a mask is already set on this Game Object it will be immediately replaced. + * + * Masks are positioned in global space and are not relative to the Game Object to which they + * are applied. The reason for this is that multiple Game Objects can all share the same mask. + * + * Masks have no impact on physics or input detection. They are purely a rendering component + * that allows you to limit what is visible during the render pass. + * @param mask The mask this Game Object will use when rendering. + */ + setMask(mask: Phaser.Display.Masks.BitmapMask | Phaser.Display.Masks.GeometryMask): this; + + /** + * Clears the mask that this Game Object was using. + * @param destroyMask Destroy the mask before clearing it? Default false. + */ + clearMask(destroyMask?: boolean): this; + + /** + * Creates and returns a Bitmap Mask. This mask can be used by any Game Object, + * including this one. + * + * Note: Bitmap Masks only work on WebGL. Geometry Masks work on both WebGL and Canvas. + * + * To create the mask you need to pass in a reference to a renderable Game Object. + * A renderable Game Object is one that uses a texture to render with, such as an + * Image, Sprite, Render Texture or BitmapText. + * + * If you do not provide a renderable object, and this Game Object has a texture, + * it will use itself as the object. This means you can call this method to create + * a Bitmap Mask from any renderable Game Object. + * @param renderable A renderable Game Object that uses a texture, such as a Sprite. + */ + createBitmapMask(renderable?: Phaser.GameObjects.GameObject): Phaser.Display.Masks.BitmapMask; + + /** + * Creates and returns a Geometry Mask. This mask can be used by any Game Object, + * including this one. + * + * To create the mask you need to pass in a reference to a Graphics Game Object. + * + * If you do not provide a graphics object, and this Game Object is an instance + * of a Graphics object, then it will use itself to create the mask. + * + * This means you can call this method to create a Geometry Mask from any Graphics Game Object. + * @param graphics A Graphics Game Object, or any kind of Shape Game Object. The geometry within it will be used as the mask. + */ + createGeometryMask(graphics?: Phaser.GameObjects.Graphics | Phaser.GameObjects.Shape): Phaser.Display.Masks.GeometryMask; + /** * The horizontal origin of this Game Object. * The origin maps the relationship between the size and position of the Game Object. @@ -96142,6 +96702,11 @@ declare namespace Phaser { */ setScrollFactor(x: number, y?: number): this; + /** + * A property indicating that a Game Object has this component. + */ + readonly hasTransformComponent: boolean; + /** * The x position of this Game Object. */