Skip to content

Commit 4fc817c

Browse files
committed
Final batch of typedefs
1 parent ccf677d commit 4fc817c

24 files changed

Lines changed: 182 additions & 153 deletions

src/tilemaps/Tilemap.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -838,14 +838,6 @@ var Tilemap = new Class({
838838
return objectLayer.objects.filter(callback, context);
839839
},
840840

841-
/**
842-
* @typedef {object} FilteringOptions
843-
*
844-
* @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index.
845-
* @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side.
846-
* @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
847-
*/
848-
849841
/**
850842
* For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
851843
* filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
@@ -863,7 +855,7 @@ var Tilemap = new Class({
863855
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter.
864856
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
865857
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
866-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
858+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
867859
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
868860
*
869861
* @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid.
@@ -951,7 +943,7 @@ var Tilemap = new Class({
951943
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search.
952944
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
953945
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
954-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
946+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
955947
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer.
956948
*
957949
* @return {?Phaser.Tilemaps.Tile} Returns a Tiles, or null if the layer given was invalid.
@@ -980,7 +972,7 @@ var Tilemap = new Class({
980972
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search.
981973
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
982974
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
983-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
975+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
984976
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The Tile layer to run the search on. If not provided will use the current layer.
985977
*
986978
* @return {?Phaser.Tilemaps.Tilemap} Returns this, or null if the layer given was invalid.
@@ -1191,7 +1183,7 @@ var Tilemap = new Class({
11911183
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area.
11921184
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
11931185
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
1194-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
1186+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
11951187
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
11961188
*
11971189
* @return {?Phaser.Tilemaps.Tile[]} Returns an array of Tiles, or null if the layer given was invalid.
@@ -1214,7 +1206,7 @@ var Tilemap = new Class({
12141206
* @since 3.0.0
12151207
*
12161208
* @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates
1217-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
1209+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
12181210
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
12191211
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
12201212
*
@@ -1240,7 +1232,7 @@ var Tilemap = new Class({
12401232
* @param {number} worldY - The world y coordinate for the top-left of the area.
12411233
* @param {number} width - The width of the area.
12421234
* @param {number} height - The height of the area.
1243-
* @param {FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
1235+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
12441236
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
12451237
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
12461238
*
@@ -1633,14 +1625,6 @@ var Tilemap = new Class({
16331625
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, layer);
16341626
},
16351627

1636-
/**
1637-
* @typedef {object} StyleConfig
1638-
*
1639-
* @property {?number} [tileColor=blue] - Color to use for drawing a filled rectangle at non-colliding tile locations. If set to null, non-colliding tiles will not be drawn.
1640-
* @property {?number} [collidingTileColor=orange] - Color to use for drawing a filled rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn.
1641-
* @property {?number} [faceColor=grey] - Color to use for drawing a line at interesting tile faces. If set to null, interesting tile faces will not be drawn.
1642-
*/
1643-
16441628
/**
16451629
* Draws a debug representation of the layer to the given Graphics. This is helpful when you want to
16461630
* get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles
@@ -1653,7 +1637,7 @@ var Tilemap = new Class({
16531637
* @since 3.0.0
16541638
*
16551639
* @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon.
1656-
* @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing.
1640+
* @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing.
16571641
* @param {(string|integer|Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer)} [layer] - The tile layer to use. If not given the current layer is used.
16581642
*
16591643
* @return {?Phaser.Tilemaps.Tilemap} Return this Tilemap object, or null if the layer given was invalid.

src/tilemaps/TilemapCreator.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@
77
var GameObjectCreator = require('../gameobjects/GameObjectCreator');
88
var ParseToTilemap = require('./ParseToTilemap');
99

10-
/**
11-
* @typedef {object} TilemapConfig
12-
*
13-
* @property {string} [key] - The key in the Phaser cache that corresponds to the loaded tilemap data.
14-
* @property {integer[][]} [data] - Instead of loading from the cache, you can also load directly from a 2D array of tile indexes.
15-
* @property {integer} [tileWidth=32] - The width of a tile in pixels.
16-
* @property {integer} [tileHeight=32] - The height of a tile in pixels.
17-
* @property {integer} [width=10] - The width of the map in tiles.
18-
* @property {integer} [height=10] - The height of the map in tiles.
19-
* @property {boolean} [insertNull=false] - Controls how empty tiles, tiles with an index of -1,
20-
* in the map data are handled. If `true`, empty locations will get a value of `null`. If `false`,
21-
* empty location will get a Tile object with an index of -1. If you've a large sparsely populated
22-
* map and the tile data doesn't need to change then setting this value to `true` will help with
23-
* memory consumption. However if your map is small or you need to update the tiles dynamically,
24-
* then leave the default value set.
25-
*/
26-
2710
/**
2811
* Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided.
2912
* When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing
@@ -33,7 +16,7 @@ var ParseToTilemap = require('./ParseToTilemap');
3316
* @method Phaser.GameObjects.GameObjectCreator#tilemap
3417
* @since 3.0.0
3518
*
36-
* @param {TilemapConfig} [config] - The config options for the Tilemap.
19+
* @param {Phaser.Tilemaps.Types.TilemapConfig} [config] - The config options for the Tilemap.
3720
*
3821
* @return {Phaser.Tilemaps.Tilemap}
3922
*/

src/tilemaps/components/GetTilesWithin.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66

77
var GetFastValue = require('../../utils/object/GetFastValue');
88

9-
/**
10-
* @typedef {object} GetTilesWithinFilteringOptions
11-
*
12-
* @property {boolean} [isNotEmpty=false] - If true, only return tiles that don't have -1 for an index.
13-
* @property {boolean} [isColliding=false] - If true, only return tiles that collide on at least one side.
14-
* @property {boolean} [hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
15-
*/
16-
179
/**
1810
* Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
1911
*
@@ -25,7 +17,7 @@ var GetFastValue = require('../../utils/object/GetFastValue');
2517
* @param {integer} tileY - The top most tile index (in tile coordinates) to use as the origin of the area.
2618
* @param {integer} width - How many tiles wide from the `tileX` index the area will be.
2719
* @param {integer} height - How many tiles tall from the `tileY` index the area will be.
28-
* @param {object} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles.
20+
* @param {Phaser.Tilemaps.Types.GetTilesWithinFilteringOptions} GetTilesWithinFilteringOptions - Optional filters to apply when getting the tiles.
2921
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
3022
*
3123
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.

src/tilemaps/dynamiclayer/DynamicTilemapLayer.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ var DynamicTilemapLayer = new Class({
513513
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to filter.
514514
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
515515
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
516-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
516+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
517517
*
518518
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
519519
*/
@@ -558,7 +558,7 @@ var DynamicTilemapLayer = new Class({
558558
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search.
559559
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
560560
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
561-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
561+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
562562
*
563563
* @return {?Phaser.Tilemaps.Tile}
564564
*/
@@ -580,7 +580,7 @@ var DynamicTilemapLayer = new Class({
580580
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area to search.
581581
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
582582
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
583-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
583+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
584584
*
585585
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
586586
*/
@@ -637,7 +637,7 @@ var DynamicTilemapLayer = new Class({
637637
* @param {integer} [tileY=0] - The top most tile index (in tile coordinates) to use as the origin of the area.
638638
* @param {integer} [width=max width based on tileX] - How many tiles wide from the `tileX` index the area will be.
639639
* @param {integer} [height=max height based on tileY] - How many tiles tall from the `tileY` index the area will be.
640-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
640+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
641641
*
642642
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
643643
*/
@@ -654,7 +654,7 @@ var DynamicTilemapLayer = new Class({
654654
* @since 3.0.0
655655
*
656656
* @param {(Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle)} shape - A shape in world (pixel) coordinates
657-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
657+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
658658
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
659659
*
660660
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
@@ -674,7 +674,7 @@ var DynamicTilemapLayer = new Class({
674674
* @param {number} worldY - The world y coordinate for the top-left of the area.
675675
* @param {number} width - The width of the area.
676676
* @param {number} height - The height of the area.
677-
* @param {object} [FilteringOptions] - Optional filters to apply when getting the tiles.
677+
* @param {Phaser.Tilemaps.Types.FilteringOptions} [filteringOptions] - Optional filters to apply when getting the tiles.
678678
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
679679
*
680680
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
@@ -860,7 +860,7 @@ var DynamicTilemapLayer = new Class({
860860
* @since 3.0.0
861861
*
862862
* @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon.
863-
* @param {StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing.
863+
* @param {Phaser.Tilemaps.Types.StyleConfig} styleConfig - An object specifying the colors to use for the debug drawing.
864864
*
865865
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
866866
*/

src/tilemaps/mapdata/MapData.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@
77
var Class = require('../../utils/Class');
88
var GetFastValue = require('../../utils/object/GetFastValue');
99

10-
/**
11-
* @typedef {object} MapDataConfig
12-
* @property {string} [name] - The key in the Phaser cache that corresponds to the loaded tilemap data.
13-
* @property {number} [width=0] - The width of the entire tilemap.
14-
* @property {number} [height=0] - The height of the entire tilemap.
15-
* @property {number} [tileWidth=0] - The width of the tiles.
16-
* @property {number} [tileHeight=0] - The height of the tiles.
17-
* @property {number} [widthInPixels] - The width in pixels of the entire tilemap.
18-
* @property {number} [heightInPixels] - The height in pixels of the entire tilemap.
19-
* @property {integer} [format] - The format of the Tilemap, as defined in Tiled.
20-
* @property {string} [orientation] - The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.
21-
* @property {string} [renderOrder] - Determines the draw order of tilemap. Default is right-down.
22-
* @property {number} [version] - The version of Tiled the map uses.
23-
* @property {number} [properties] - Map specific properties (can be specified in Tiled).
24-
* @property {Phaser.Tilemaps.LayerData[]} [layers] - The layers of the tilemap.
25-
* @property {array} [images] - An array with all the layers configured to the MapData.
26-
* @property {object} [objects] - An array of Tiled Image Layers.
27-
* @property {object} [collision] - An object of Tiled Object Layers.
28-
* @property {Phaser.Tilemaps.Tileset[]} [tilesets] - The tilesets the map uses.
29-
* @property {array} [imageCollections] - The collection of images the map uses(specified in Tiled).
30-
* @property {array} [tiles] - [description]
31-
*/
32-
3310
/**
3411
* @classdesc
3512
* A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this
@@ -41,7 +18,7 @@ var GetFastValue = require('../../utils/object/GetFastValue');
4118
* @constructor
4219
* @since 3.0.0
4320
*
44-
* @param {MapDataConfig} [config] - [description]
21+
* @param {Phaser.Tilemaps.Types.MapDataConfig} [config] - The Map configuration object.
4522
*/
4623
var MapData = new Class({
4724

0 commit comments

Comments
 (0)