From 4ee569ff9e94600d926e64a4ebd55f9cc0838a08 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 21 Jul 2023 18:43:36 +0100 Subject: [PATCH] 3.61.0 TS Defs --- types/phaser.d.ts | 159 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 118 insertions(+), 41 deletions(-) diff --git a/types/phaser.d.ts b/types/phaser.d.ts index 20b12d8a9..63220c075 100644 --- a/types/phaser.d.ts +++ b/types/phaser.d.ts @@ -10294,6 +10294,11 @@ declare namespace Phaser { */ backgroundColor: number; + /** + * The alpha of the background, behind the texture, given as a number value. + */ + backgroundAlpha: number; + } /** @@ -10589,10 +10594,10 @@ declare namespace Phaser { * @param color1 The first gradient color, given as a number value. Default 0xff0000. * @param color2 The second gradient color, given as a number value. Default 0x00ff00. * @param alpha The alpha value of the gradient effect. Default 0.2. - * @param fromX The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param fromY The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param toX The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param toY The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. Default 1. + * @param fromX The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param fromY The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param toX The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param toY The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels. Default 1. * @param size 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. Default 0. */ constructor(gameObject: Phaser.GameObjects.GameObject, color1?: number, color2?: number, alpha?: number, fromX?: number, fromY?: number, toX?: number, toY?: number, size?: number); @@ -10611,22 +10616,22 @@ declare namespace Phaser { size: number; /** - * 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. */ fromX: number; /** - * 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. */ fromY: number; /** - * 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. */ toX: number; /** - * 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. */ toY: number; @@ -14988,10 +14993,10 @@ declare namespace Phaser { * @param color1 The first gradient color, given as a number value. Default 0xff0000. * @param color2 The second gradient color, given as a number value. Default 0x00ff00. * @param alpha The alpha value of the gradient effect. Default 0.2. - * @param fromX The horizontal position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param fromY The vertical position the gradient will start from. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param toX The horizontal position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. Default 0. - * @param toY The vertical position the gradient will end at. This value is noralized, between 0 and 1 and is not in pixels. Default 1. + * @param fromX The horizontal position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param fromY The vertical position the gradient will start from. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param toX The horizontal position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels. Default 0. + * @param toY The vertical position the gradient will end at. This value is normalized, between 0 and 1, and is not in pixels. Default 1. * @param size 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. Default 0. */ addGradient(color1?: number, color2?: number, alpha?: number, fromX?: number, fromY?: number, toX?: number, toY?: number, size?: number): Phaser.FX.Gradient; @@ -29451,6 +29456,11 @@ declare namespace Phaser { */ removeDeathZone(zone: Phaser.GameObjects.Particles.Zones.DeathZone): this; + /** + * Clear all Death Zones from this Particle Emitter. + */ + clearDeathZones(): this; + /** * Adds a new Particle Emission Zone to this Emitter. * @@ -29472,6 +29482,11 @@ declare namespace Phaser { */ removeEmitZone(zone: Phaser.GameObjects.Particles.Zones.EdgeZone | Phaser.GameObjects.Particles.Zones.RandomZone): this; + /** + * Clear all Emission Zones from this Particle Emitter. + */ + clearEmitZones(): 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 @@ -29792,7 +29807,7 @@ declare namespace Phaser { * Accessing this property should typically return a number. * However, it can be set to any valid EmitterOp onEmit type. */ - particleX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType; + particleX: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType; /** * The y coordinate the particles are emitted from. @@ -29802,7 +29817,7 @@ declare namespace Phaser { * Accessing this property should typically return a number. * However, it can be set to any valid EmitterOp onEmit type. */ - particleY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType; + particleY: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType; /** * The horizontal acceleration applied to emitted particles, in pixels per second squared. @@ -49408,6 +49423,15 @@ declare namespace Phaser { */ lineSpacing: number; + /** + * 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. + */ + letterSpacing: number; + /** * Whether the text or its settings have changed and need updating. */ @@ -49665,6 +49689,21 @@ declare namespace Phaser { */ setLineSpacing(value: number): this; + /** + * 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. + * @param value The amount to add to the letter width. Set to zero to disable. + */ + setLetterSpacing(value: number): this; + /** * Set the text padding. * @@ -49684,6 +49723,12 @@ declare namespace Phaser { */ setMaxLines(max?: number): this; + /** + * Render text from right-to-left or left-to-right. + * @param rtl Set to `true` to render from right-to-left. Default true. + */ + setRTL(rtl?: boolean): this; + /** * Update the displayed text. */ @@ -72170,11 +72215,11 @@ declare namespace Phaser { /** * Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleX}. */ - x?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType; + x?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType; /** * Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#particleY}. */ - y?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType; + y?: Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType | Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType; /** * As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. */ @@ -84488,6 +84533,11 @@ declare namespace Phaser { */ step(delta: number): void; + /** + * Advances the simulation by a single step. + */ + singleStep(): void; + /** * Updates bodies, draws the debug display, and handles pending queue operations. */ @@ -92429,7 +92479,7 @@ declare namespace Phaser { * sprite.postFX.addBarrel(); * ``` */ - class BarrelFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class BarrelFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92461,7 +92511,7 @@ declare namespace Phaser { * sprite.postFX.addBloom(); * ``` */ - class BloomFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class BloomFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92524,7 +92574,7 @@ declare namespace Phaser { * sprite.postFX.addBlur(); * ``` */ - class BlurFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class BlurFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92601,7 +92651,7 @@ declare namespace Phaser { * sprite.postFX.addBokeh(); * ``` */ - class BokehFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class BokehFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92674,7 +92724,7 @@ declare namespace Phaser { * sprite.postFX.addCircle(); * ``` */ - class CircleFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class CircleFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92734,7 +92784,7 @@ declare namespace Phaser { * sprite.postFX.addColorMatrix(); * ``` */ - class ColorMatrixFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class ColorMatrixFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92760,7 +92810,7 @@ declare namespace Phaser { * sprite.postFX.addDisplacement(); * ``` */ - class DisplacementFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class DisplacementFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92800,7 +92850,7 @@ declare namespace Phaser { * sprite.postFX.addGlow(); * ``` */ - class GlowFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class GlowFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92846,7 +92896,7 @@ declare namespace Phaser { * sprite.postFX.addGradient(); * ``` */ - class GradientFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class GradientFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92867,22 +92917,22 @@ declare namespace Phaser { size: number; /** - * 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. */ fromX: number; /** - * 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. */ fromY: number; /** - * 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. */ toX: number; /** - * 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. */ toY: number; @@ -92914,7 +92964,7 @@ declare namespace Phaser { * sprite.postFX.addPixelate(); * ``` */ - class PixelateFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class PixelateFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -92943,7 +92993,7 @@ declare namespace Phaser { * sprite.postFX.addShadow(); * ``` */ - class ShadowFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class ShadowFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -93005,7 +93055,7 @@ declare namespace Phaser { * sprite.postFX.addShine(); * ``` */ - class ShineFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class ShineFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -93049,7 +93099,7 @@ declare namespace Phaser { * sprite.postFX.addVignette(); * ``` */ - class VignetteFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class VignetteFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -93104,7 +93154,7 @@ declare namespace Phaser { * sprite.postFX.addReveal(); * ``` */ - class WipeFXPipeline extends Phaser.Renderer.WebGL.WebGLPipeline { + class WipeFXPipeline extends Phaser.Renderer.WebGL.Pipelines.PostFXPipeline { /** * * @param game A reference to the Phaser Game instance. @@ -105740,6 +105790,13 @@ declare namespace Phaser { */ name: string; + /** + * 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. + */ + id: number; + /** * The x offset of where to draw from the top left. */ @@ -106026,6 +106083,11 @@ declare namespace Phaser { */ name: string; + /** + * The id of the object layer, as specified in the map data. + */ + id: number; + /** * The opacity of the layer, between 0 and 1. */ @@ -107141,12 +107203,25 @@ declare namespace Phaser { * 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 @@ -112786,8 +112861,9 @@ declare namespace Phaser { * ] * ``` * @param matrix The array to rotate. + * @param amount The number of times to rotate the matrix. Default 1. */ - function RotateLeft(matrix?: T[][]): T[][]; + function RotateLeft(matrix?: T[][], amount?: number): T[][]; /** * Rotates the array matrix based on the given rotation value. @@ -112832,8 +112908,9 @@ declare namespace Phaser { * ] * ``` * @param matrix The array to rotate. + * @param amount The number of times to rotate the matrix. Default 1. */ - function RotateRight(matrix?: T[][]): T[][]; + function RotateRight(matrix?: T[][], amount?: number): T[][]; /** * Translates the given Array Matrix by shifting each column and row the