Skip to content

Commit 03af5e1

Browse files
committed
TilemapLayer/Tileset - Documentation consistency updates for Phaser
1 parent 75f13cf commit 03af5e1

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/tilemap/TilemapLayer.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
165165

166166
/**
167167
* Speed at which this layer scrolls horizontally, relative to the camera (e.g. scrollFactorX of 0.5 scrolls half as quickly as the 'normal' camera-locked layers do).
168-
*
169168
* @property {number} scrollFactorX
169+
* @public
170170
* @default
171171
*/
172172
this.scrollFactorX = 1;
@@ -197,7 +197,6 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
197197
* Flag controlling if the layer tiles wrap at the edges.
198198
* @property {boolean} _wrap
199199
* @private
200-
* @default
201200
*/
202201
this._wrap = false;
203202

@@ -294,6 +293,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, 'tileColor', {
294293
/**
295294
* Automatically called by World.postUpdate. Handles cache updates.
296295
*
296+
* @method Phaser.TilemapLayer#postUpdate
297297
* @protected
298298
*/
299299
Phaser.TilemapLayer.prototype.postUpdate = function () {
@@ -325,6 +325,7 @@ Phaser.TilemapLayer.prototype.postUpdate = function () {
325325
/**
326326
* Sets the world size to match the size of this layer.
327327
*
328+
* @method Phaser.TilemapLayer#resizeWorld
328329
* @public
329330
*/
330331
Phaser.TilemapLayer.prototype.resizeWorld = function () {
@@ -336,6 +337,7 @@ Phaser.TilemapLayer.prototype.resizeWorld = function () {
336337
/**
337338
* Take an x coordinate that doesn't account for scrollFactorX and 'fix' it into a scrolled local space.
338339
*
340+
* @method Phaser.TilemapLayer#_fixX
339341
* @private
340342
* @param {number} x - x coordinate in camera space
341343
* @return {number} x coordinate in scrollFactor-adjusted dimensions
@@ -359,6 +361,7 @@ Phaser.TilemapLayer.prototype._fixX = function (x) {
359361
/**
360362
* Take an x coordinate that _does_ account for scrollFactorX and 'unfix' it back to camera space.
361363
*
364+
* @method Phaser.TilemapLayer#_unfixX
362365
* @private
363366
* @param {number} x - x coordinate in scrollFactor-adjusted dimensions
364367
* @return {number} x coordinate in camera space
@@ -377,6 +380,7 @@ Phaser.TilemapLayer.prototype._unfixX = function (x) {
377380
/**
378381
* Take a y coordinate that doesn't account for scrollFactorY and 'fix' it into a scrolled local space.
379382
*
383+
* @method Phaser.TilemapLayer#_fixY
380384
* @private
381385
* @param {number} y - y coordinate in camera space
382386
* @return {number} y coordinate in scrollFactor-adjusted dimensions
@@ -400,6 +404,7 @@ Phaser.TilemapLayer.prototype._fixY = function (y) {
400404
/**
401405
* Take a y coordinate that _does_ account for scrollFactorY and 'unfix' it back to camera space.
402406
*
407+
* @method Phaser.TilemapLayer#_unfixY
403408
* @private
404409
* @param {number} y - y coordinate in scrollFactor-adjusted dimensions
405410
* @return {number} y coordinate in camera space
@@ -418,6 +423,7 @@ Phaser.TilemapLayer.prototype._unfixY = function (y) {
418423
/**
419424
* Convert a pixel value to a tile coordinate.
420425
*
426+
* @method Phaser.TilemapLayer#getTileX
421427
* @public
422428
* @param {number} x - X position of the point in target tile (in pixels).
423429
* @return {integer} The X map location of the tile.
@@ -432,6 +438,7 @@ Phaser.TilemapLayer.prototype.getTileX = function (x) {
432438
/**
433439
* Convert a pixel value to a tile coordinate.
434440
*
441+
* @method Phaser.TilemapLayer#getTileY
435442
* @public
436443
* @param {number} y - Y position of the point in target tile (in pixels).
437444
* @return {integer} The Y map location of the tile.
@@ -446,6 +453,7 @@ Phaser.TilemapLayer.prototype.getTileY = function (y) {
446453
/**
447454
* Convert a pixel coordinate to a tile coordinate.
448455
*
456+
* @method Phaser.TilemapLayer#getTileXY
449457
* @public
450458
* @param {number} x - X position of the point in target tile (in pixels).
451459
* @param {number} y - Y position of the point in target tile (in pixels).
@@ -464,6 +472,7 @@ Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
464472
/**
465473
* Gets all tiles that intersect with the given line.
466474
*
475+
* @method Phaser.TilemapLayer#getRayCastTiles
467476
* @public
468477
* @param {Phaser.Line} line - The line used to determine which tiles to return.
469478
* @param {integer} [stepRate=(rayStepRate)] - How many steps through the ray will we check? Defaults to `rayStepRate`.
@@ -510,6 +519,7 @@ Phaser.TilemapLayer.prototype.getRayCastTiles = function (line, stepRate, collid
510519
/**
511520
* Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
512521
*
522+
* @method Phaser.TilemapLayer#getTiles
513523
* @public
514524
* @param {number} x - X position of the top left corner (in pixels).
515525
* @param {number} y - Y position of the top left corner (in pixels).
@@ -589,6 +599,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "wrap", {
589599
/**
590600
* Returns the appropriate tileset for the index, updating the internal cache as required. This should only be called if `tilesets[index]` evaluates to undefined.
591601
*
602+
* @method Phaser.TilemapLayer#resolveTileset
592603
* @private
593604
* @param {integer} Tile index
594605
* @return {Phaser.Tileset|null} Returns the associated tileset or null if there is no such mapping.
@@ -622,6 +633,7 @@ Phaser.TilemapLayer.prototype.resolveTileset = function (tileIndex)
622633
/**
623634
* The TilemapLayer caches tileset look-ups. Call this method of clear the cache if tilesets have been added or updated after the layer has been rendered.
624635
*
636+
* @method Phaser.TilemapLayer#resetTilesetCache
625637
* @public
626638
*/
627639
Phaser.TilemapLayer.prototype.resetTilesetCache = function ()
@@ -637,6 +649,7 @@ Phaser.TilemapLayer.prototype.resetTilesetCache = function ()
637649
/**
638650
* Shifts the contents of the canvas - does extra math so that different browsers agree on the result. The specified (x/y) will be shifted to (0,0) after the copy. The newly exposed canvas area will need to be filled in. This method is problematic for transparent tiles.
639651
*
652+
* @method Phaser.TilemapLayer#shiftCanvas
640653
* @private
641654
* @param {CanvasRenderingContext2D} context - The context to shift
642655
* @param {integer} x
@@ -677,6 +690,7 @@ Phaser.TilemapLayer.prototype.shiftCanvas = function (context, x, y)
677690
* Render tiles in the given area given by the virtual tile coordinates biased by the given scroll factor.
678691
* This will constrain the tile coordinates based on wrapping but not physical coordinates.
679692
*
693+
* @method Phaser.TilemapLayer#renderRegion
680694
* @private
681695
* @param {integer} scrollX - Render x offset/scroll.
682696
* @param {integer} scrollY - Render y offset/scroll.
@@ -788,6 +802,7 @@ Phaser.TilemapLayer.prototype.renderRegion = function (scrollX, scrollY, left, t
788802
/**
789803
* Shifts the canvas and render damaged edge tiles.
790804
*
805+
* @method Phaser.TilemapLayer#renderDeltaScroll
791806
* @private
792807
*/
793808
Phaser.TilemapLayer.prototype.renderDeltaScroll = function (shiftX, shiftY) {
@@ -863,6 +878,7 @@ Phaser.TilemapLayer.prototype.renderDeltaScroll = function (shiftX, shiftY) {
863878
/**
864879
* Clear and render the entire canvas.
865880
*
881+
* @method Phaser.TilemapLayer#renderFull
866882
* @private
867883
*/
868884
Phaser.TilemapLayer.prototype.renderFull = function ()
@@ -891,6 +907,7 @@ Phaser.TilemapLayer.prototype.renderFull = function ()
891907
/**
892908
* Renders the tiles to the layer canvas and pushes to the display.
893909
*
910+
* @method Phaser.TilemapLayer#render
894911
* @protected
895912
*/
896913
Phaser.TilemapLayer.prototype.render = function () {
@@ -977,6 +994,7 @@ Phaser.TilemapLayer.prototype.render = function () {
977994
*
978995
* See `debugSettings` for assorted configuration options.
979996
*
997+
* @method Phaser.TilemapLayer#renderDebug
980998
* @private
981999
*/
9821000
Phaser.TilemapLayer.prototype.renderDebug = function () {

src/tilemap/Tileset.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ Phaser.Tileset.prototype = {
123123
* Draws a tile from this Tileset at the given coordinates on the context.
124124
*
125125
* @method Phaser.Tileset#draw
126+
* @public
126127
* @param {CanvasRenderingContext2D} context - The context to draw the tile onto.
127128
* @param {number} x - The x coordinate to draw to.
128129
* @param {number} y - The y coordinate to draw to.
@@ -153,6 +154,7 @@ Phaser.Tileset.prototype = {
153154
/**
154155
* Returns true if and only if this tileset contains the given tile index.
155156
*
157+
* @method Phaser.Tileset#containsTileIndex
156158
* @public
157159
* @return {boolean} True if this tileset contains the given index.
158160
*/
@@ -169,6 +171,7 @@ Phaser.Tileset.prototype = {
169171
/**
170172
* Set the image associated with this Tileset and update the tile data.
171173
*
174+
* @method Phaser.Tileset#setImage
172175
* @public
173176
* @param {Image} image - The image that contains the tiles.
174177
*/
@@ -182,6 +185,7 @@ Phaser.Tileset.prototype = {
182185
/**
183186
* Sets tile spacing and margins.
184187
*
188+
* @method Phaser.Tileset#setSpacing
185189
* @public
186190
* @param {integer} tileMargin - The margin around the tiles in the sheet (in pixels).
187191
* @param {integer} tileSpacing - The spacing between the tiles in the sheet (in pixels).
@@ -197,8 +201,9 @@ Phaser.Tileset.prototype = {
197201

198202
/**
199203
* Updates tile coordinates and tileset data.
200-
*
201-
* @protected
204+
*
205+
* @method Phaser.Tileset#updateTileData
206+
* @private
202207
*/
203208
updateTileData: function () {
204209

0 commit comments

Comments
 (0)