From 79114a00e528b866c502450011a091bad4e4d4de Mon Sep 17 00:00:00 2001 From: Patrick Sletvold Date: Fri, 25 Sep 2020 18:26:44 +0200 Subject: [PATCH 1/3] Add return type for ParseRetroFont --- src/gameobjects/bitmaptext/ParseRetroFont.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gameobjects/bitmaptext/ParseRetroFont.js b/src/gameobjects/bitmaptext/ParseRetroFont.js index b6ce7227a..ea18c1e44 100644 --- a/src/gameobjects/bitmaptext/ParseRetroFont.js +++ b/src/gameobjects/bitmaptext/ParseRetroFont.js @@ -16,7 +16,7 @@ var GetValue = require('../../utils/object/GetValue'); * @param {Phaser.Scene} scene - A reference to the Phaser Scene. * @param {Phaser.Types.GameObjects.BitmapText.RetroFontConfig} config - The font configuration object. * - * @return {object} A parsed Bitmap Font data entry for the Bitmap Font cache. + * @return {Phaser.Types.GameObjects.BitmapText.BitmapFontData} A parsed Bitmap Font data entry for the Bitmap Font cache. */ var ParseRetroFont = function (scene, config) { From c1d63d32dd589abec90992210a6a384ba3e25366 Mon Sep 17 00:00:00 2001 From: Patrick Sletvold Date: Sat, 3 Oct 2020 10:40:24 +0200 Subject: [PATCH 2/3] Add Config typedefs for a bunch of GO Creators --- src/gameobjects/blitter/BlitterCreator.js | 2 +- src/gameobjects/container/ContainerCreator.js | 2 +- .../container/typedefs/ContainerConfig.js | 7 +++++++ src/gameobjects/container/typedefs/index.js | 9 +++++++++ src/gameobjects/graphics/GraphicsCreator.js | 2 +- src/gameobjects/image/ImageCreator.js | 2 +- src/gameobjects/layer3d/Layer3DCreator.js | 2 +- src/gameobjects/quad/QuadCreator.js | 2 +- src/gameobjects/rope/RopeCreator.js | 2 +- src/gameobjects/rope/typedefs/RopeConfig.js | 12 ++++++++++++ src/gameobjects/rope/typedefs/index.js | 9 +++++++++ src/gameobjects/shader/ShaderCreator.js | 2 +- src/gameobjects/shader/typedefs/ShaderConfig.js | 9 +++++++++ src/gameobjects/shader/typedefs/index.js | 9 +++++++++ src/gameobjects/video/VideoCreator.js | 2 +- src/gameobjects/video/typedefs/VideoConfig.js | 7 +++++++ src/gameobjects/video/typedefs/index.js | 9 +++++++++ src/gameobjects/zone/ZoneCreator.js | 2 +- src/gameobjects/zone/typedefs/ZoneConfig.js | 8 ++++++++ src/gameobjects/zone/typedefs/index.js | 9 +++++++++ 20 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 src/gameobjects/container/typedefs/ContainerConfig.js create mode 100644 src/gameobjects/container/typedefs/index.js create mode 100644 src/gameobjects/rope/typedefs/RopeConfig.js create mode 100644 src/gameobjects/rope/typedefs/index.js create mode 100644 src/gameobjects/shader/typedefs/ShaderConfig.js create mode 100644 src/gameobjects/shader/typedefs/index.js create mode 100644 src/gameobjects/video/typedefs/VideoConfig.js create mode 100644 src/gameobjects/video/typedefs/index.js create mode 100644 src/gameobjects/zone/typedefs/ZoneConfig.js create mode 100644 src/gameobjects/zone/typedefs/index.js diff --git a/src/gameobjects/blitter/BlitterCreator.js b/src/gameobjects/blitter/BlitterCreator.js index f7ed4a09e..68d8b979c 100644 --- a/src/gameobjects/blitter/BlitterCreator.js +++ b/src/gameobjects/blitter/BlitterCreator.js @@ -17,7 +17,7 @@ var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); * @method Phaser.GameObjects.GameObjectCreator#blitter * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Blitter} The Game Object that was created. diff --git a/src/gameobjects/container/ContainerCreator.js b/src/gameobjects/container/ContainerCreator.js index e1d6361a1..8c2e42304 100644 --- a/src/gameobjects/container/ContainerCreator.js +++ b/src/gameobjects/container/ContainerCreator.js @@ -18,7 +18,7 @@ var GetAdvancedValue = require('../../utils/object/GetAdvancedValue'); * @method Phaser.GameObjects.GameObjectCreator#container * @since 3.4.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Container.ContainerConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Container} The Game Object that was created. diff --git a/src/gameobjects/container/typedefs/ContainerConfig.js b/src/gameobjects/container/typedefs/ContainerConfig.js new file mode 100644 index 000000000..aabf189c2 --- /dev/null +++ b/src/gameobjects/container/typedefs/ContainerConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Container.ContainerConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.50.0 + * + * @property {Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to the Container. + */ diff --git a/src/gameobjects/container/typedefs/index.js b/src/gameobjects/container/typedefs/index.js new file mode 100644 index 000000000..5ec4169f8 --- /dev/null +++ b/src/gameobjects/container/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Container + */ diff --git a/src/gameobjects/graphics/GraphicsCreator.js b/src/gameobjects/graphics/GraphicsCreator.js index 0437ba08c..8cc4ec7b1 100644 --- a/src/gameobjects/graphics/GraphicsCreator.js +++ b/src/gameobjects/graphics/GraphicsCreator.js @@ -15,7 +15,7 @@ var Graphics = require('./Graphics'); * @method Phaser.GameObjects.GameObjectCreator#graphics * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Graphics.Options} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Graphics} The Game Object that was created. diff --git a/src/gameobjects/image/ImageCreator.js b/src/gameobjects/image/ImageCreator.js index a9487f96e..f95d376cc 100644 --- a/src/gameobjects/image/ImageCreator.js +++ b/src/gameobjects/image/ImageCreator.js @@ -17,7 +17,7 @@ var Image = require('./Image'); * @method Phaser.GameObjects.GameObjectCreator#image * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Image} The Game Object that was created. diff --git a/src/gameobjects/layer3d/Layer3DCreator.js b/src/gameobjects/layer3d/Layer3DCreator.js index 547844caf..07e7da089 100644 --- a/src/gameobjects/layer3d/Layer3DCreator.js +++ b/src/gameobjects/layer3d/Layer3DCreator.js @@ -16,7 +16,7 @@ var Layer3D = require('./Layer3D'); * @method Phaser.GameObjects.GameObjectCreator#layer3d * @since 3.50.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.GameObjectConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Layer3D} The Game Object that was created. diff --git a/src/gameobjects/quad/QuadCreator.js b/src/gameobjects/quad/QuadCreator.js index df7d56e99..462d90f07 100644 --- a/src/gameobjects/quad/QuadCreator.js +++ b/src/gameobjects/quad/QuadCreator.js @@ -17,7 +17,7 @@ var Quad = require('./Quad'); * @method Phaser.GameObjects.GameObjectCreator#quad * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Sprite.SpriteConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Quad} The Game Object that was created. diff --git a/src/gameobjects/rope/RopeCreator.js b/src/gameobjects/rope/RopeCreator.js index b677017d2..0e6363714 100644 --- a/src/gameobjects/rope/RopeCreator.js +++ b/src/gameobjects/rope/RopeCreator.js @@ -18,7 +18,7 @@ var Rope = require('./Rope'); * @method Phaser.GameObjects.GameObjectCreator#rope * @since 3.23.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Rope.RopeConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Rope} The Game Object that was created. diff --git a/src/gameobjects/rope/typedefs/RopeConfig.js b/src/gameobjects/rope/typedefs/RopeConfig.js new file mode 100644 index 000000000..5580186b2 --- /dev/null +++ b/src/gameobjects/rope/typedefs/RopeConfig.js @@ -0,0 +1,12 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Rope.RopeConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.50.0 + * + * @property {string} [key] - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager. If not given, `__DEFAULT` is used. + * @property {(string|integer|null)} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @property {(integer|Phaser.Types.Math.Vector2Like[])} [points=2] - An array containing the vertices data for this Rope, or a number that indicates how many segments to split the texture frame into. If none is provided a simple quad is created. See `setPoints` to set this post-creation. + * @property {boolean} [horizontal=true] - Should the vertices of this Rope be aligned horizontally (`true`), or vertically (`false`)? + * @property {number[]} [colors] - An optional array containing the color data for this Rope. You should provide one color value per pair of vertices. + * @property {number[]} [alphas] - An optional array containing the alpha data for this Rope. You should provide one alpha value per pair of vertices. + */ diff --git a/src/gameobjects/rope/typedefs/index.js b/src/gameobjects/rope/typedefs/index.js new file mode 100644 index 000000000..df11e152c --- /dev/null +++ b/src/gameobjects/rope/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Rope + */ diff --git a/src/gameobjects/shader/ShaderCreator.js b/src/gameobjects/shader/ShaderCreator.js index f9a80950a..ea8237ff3 100644 --- a/src/gameobjects/shader/ShaderCreator.js +++ b/src/gameobjects/shader/ShaderCreator.js @@ -17,7 +17,7 @@ var Shader = require('./Shader'); * @method Phaser.GameObjects.GameObjectCreator#shader * @since 3.17.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Shader.ShaderConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Shader} The Game Object that was created. diff --git a/src/gameobjects/shader/typedefs/ShaderConfig.js b/src/gameobjects/shader/typedefs/ShaderConfig.js new file mode 100644 index 000000000..22cd44365 --- /dev/null +++ b/src/gameobjects/shader/typedefs/ShaderConfig.js @@ -0,0 +1,9 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Shader.ShaderConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.50.0 + * + * @property {(string|Phaser.Display.BaseShader)} key - The key of the shader to use from the shader cache, or a BaseShader instance. + * @property {number} [width=128] - The width of the Game Object. + * @property {number} [height=128] - The height of the Game Object. + */ diff --git a/src/gameobjects/shader/typedefs/index.js b/src/gameobjects/shader/typedefs/index.js new file mode 100644 index 000000000..43bdf5975 --- /dev/null +++ b/src/gameobjects/shader/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Shader + */ diff --git a/src/gameobjects/video/VideoCreator.js b/src/gameobjects/video/VideoCreator.js index d30bd1c51..a7f4528fa 100644 --- a/src/gameobjects/video/VideoCreator.js +++ b/src/gameobjects/video/VideoCreator.js @@ -17,7 +17,7 @@ var Video = require('./Video'); * @method Phaser.GameObjects.GameObjectCreator#video * @since 3.20.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Video.VideoConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Video} The Game Object that was created. diff --git a/src/gameobjects/video/typedefs/VideoConfig.js b/src/gameobjects/video/typedefs/VideoConfig.js new file mode 100644 index 000000000..37d75640e --- /dev/null +++ b/src/gameobjects/video/typedefs/VideoConfig.js @@ -0,0 +1,7 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Video.VideoConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.50.0 + * + * @property {string} [key] - Optional key of the Video this Game Object will play, as stored in the Video Cache. + */ diff --git a/src/gameobjects/video/typedefs/index.js b/src/gameobjects/video/typedefs/index.js new file mode 100644 index 000000000..894fb1df3 --- /dev/null +++ b/src/gameobjects/video/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Video + */ diff --git a/src/gameobjects/zone/ZoneCreator.js b/src/gameobjects/zone/ZoneCreator.js index 2b2ba09da..a7817b65c 100644 --- a/src/gameobjects/zone/ZoneCreator.js +++ b/src/gameobjects/zone/ZoneCreator.js @@ -16,7 +16,7 @@ var Zone = require('./Zone'); * @method Phaser.GameObjects.GameObjectCreator#zone * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Zone.ZoneConfig} config - The configuration object this Game Object will use to create itself. * * @return {Phaser.GameObjects.Zone} The Game Object that was created. */ diff --git a/src/gameobjects/zone/typedefs/ZoneConfig.js b/src/gameobjects/zone/typedefs/ZoneConfig.js new file mode 100644 index 000000000..44f1d6959 --- /dev/null +++ b/src/gameobjects/zone/typedefs/ZoneConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Zone.ZoneConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.50.0 + * + * @property {number} [width=1] - The width of the Game Object. + * @property {number} [height=1] - The height of the Game Object. + */ diff --git a/src/gameobjects/zone/typedefs/index.js b/src/gameobjects/zone/typedefs/index.js new file mode 100644 index 000000000..98d3bb3c1 --- /dev/null +++ b/src/gameobjects/zone/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Zone + */ From d327a4da348c77b0d694df3b8a86c7b8c91b03dc Mon Sep 17 00:00:00 2001 From: Patrick Sletvold Date: Thu, 10 Dec 2020 11:40:01 +0100 Subject: [PATCH 3/3] Add Config types for ParticleEmitterManager and Mesh --- src/gameobjects/mesh/MeshCreator.js | 2 +- src/gameobjects/mesh/typedefs/MeshConfig.js | 15 +++++++++++++++ src/gameobjects/mesh/typedefs/index.js | 9 +++++++++ .../particles/ParticleManagerCreator.js | 2 +- .../typedefs/ParticleEmitterManagerConfig.js | 8 ++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/gameobjects/mesh/typedefs/MeshConfig.js create mode 100644 src/gameobjects/mesh/typedefs/index.js create mode 100644 src/gameobjects/particles/typedefs/ParticleEmitterManagerConfig.js diff --git a/src/gameobjects/mesh/MeshCreator.js b/src/gameobjects/mesh/MeshCreator.js index 4125d4024..6f9634cb9 100644 --- a/src/gameobjects/mesh/MeshCreator.js +++ b/src/gameobjects/mesh/MeshCreator.js @@ -18,7 +18,7 @@ var Mesh = require('./Mesh'); * @method Phaser.GameObjects.GameObjectCreator#mesh * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Mesh.MeshConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Mesh} The Game Object that was created. diff --git a/src/gameobjects/mesh/typedefs/MeshConfig.js b/src/gameobjects/mesh/typedefs/MeshConfig.js new file mode 100644 index 000000000..f16873783 --- /dev/null +++ b/src/gameobjects/mesh/typedefs/MeshConfig.js @@ -0,0 +1,15 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Mesh.MeshConfig + * @extends Phaser.Types.GameObjects.GameObjectConfig + * @since 3.0.0 + * + * @property {string} [key] - The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. + * @property {string|number} [frame] - An optional frame from the Texture this Game Object is rendering with. + * @property {number[]} [vertices] - The vertices array. Either `xy` pairs, or `xyz` if the `containsZ` parameter is `true`. + * @property {number[]} [uvs] - The UVs pairs array. + * @property {number[]} [indicies] - Optional vertex indicies array. If you don't have one, pass `null` or an empty array. + * @property {boolean} [containsZ=false] - Does the vertices data include a `z` component? + * @property {number[]} [normals] - Optional vertex normals array. If you don't have one, pass `null` or an empty array. + * @property {number|number[]} [colors=0xffffff] - An array of colors, one per vertex, or a single color value applied to all vertices. + * @property {number|number[]} [alphas=1] - An array of alpha values, one per vertex, or a single alpha value applied to all vertices. + */ diff --git a/src/gameobjects/mesh/typedefs/index.js b/src/gameobjects/mesh/typedefs/index.js new file mode 100644 index 000000000..be2056cb7 --- /dev/null +++ b/src/gameobjects/mesh/typedefs/index.js @@ -0,0 +1,9 @@ +/** + * @author Richard Davey + * @copyright 2020 Photon Storm Ltd. + * @license {@link https://opensource.org/licenses/MIT|MIT License} + */ + +/** + * @namespace Phaser.Types.GameObjects.Mesh + */ diff --git a/src/gameobjects/particles/ParticleManagerCreator.js b/src/gameobjects/particles/ParticleManagerCreator.js index 4c1c9f386..69b87c7f2 100644 --- a/src/gameobjects/particles/ParticleManagerCreator.js +++ b/src/gameobjects/particles/ParticleManagerCreator.js @@ -17,7 +17,7 @@ var ParticleEmitterManager = require('./ParticleEmitterManager'); * @method Phaser.GameObjects.GameObjectCreator#particles * @since 3.0.0 * - * @param {object} config - The configuration object this Game Object will use to create itself. + * @param {Phaser.Types.GameObjects.Particles.ParticleEmitterManagerConfig} config - The configuration object this Game Object will use to create itself. * @param {boolean} [addToScene] - Add this Game Object to the Scene after creating it? If set this argument overrides the `add` property in the config object. * * @return {Phaser.GameObjects.Particles.ParticleEmitterManager} The Game Object that was created. diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterManagerConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterManagerConfig.js new file mode 100644 index 000000000..e2fae4dab --- /dev/null +++ b/src/gameobjects/particles/typedefs/ParticleEmitterManagerConfig.js @@ -0,0 +1,8 @@ +/** + * @typedef {object} Phaser.Types.GameObjects.Particles.ParticleEmitterManagerConfig + * @since 3.0.0 + * + * @property {string} [key] - The key of the Texture this Emitter Manager will use to render particles, as stored in the Texture Manager. + * @property {(number|string)} [frame] - An optional frame from the Texture this Emitter Manager will use to render particles. + * @property {Phaser.Types.GameObjects.Particles.ParticleEmitterConfig|Phaser.Types.GameObjects.Particles.ParticleEmitterConfig[]} [emitters] - Configuration settings for one or more emitters to create. + */