Skip to content

Commit 42d6188

Browse files
committed
Now using the GetCullTilesFunction phaserjs#4922
1 parent 7895a36 commit 42d6188

2 files changed

Lines changed: 25 additions & 11 deletions

File tree

src/tilemaps/dynamiclayer/DynamicTilemapLayer.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,29 @@ var DynamicTilemapLayer = new Class({
208208
/**
209209
* The callback that is invoked when the tiles are culled.
210210
*
211-
* By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
211+
* It will call a different function based on the map orientation:
212212
*
213-
* It will be sent 3 arguments:
213+
* Orthogonal (the default) is `TilemapComponents.CullTiles`
214+
* Isometric is `TilemapComponents.IsometricCullTiles`
215+
* Hexagonal is `TilemapComponents.HexagonalCullTiles`
216+
* Staggered is `TilemapComponents.StaggeredCullTiles`
217+
*
218+
* Howevr, you can override this to call any function you like.
219+
*
220+
* It will be sent 4 arguments:
214221
*
215222
* 1. The Phaser.Tilemaps.LayerData object for this Layer
216223
* 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
217224
* 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
225+
* 4. The Render Order constant.
218226
*
219227
* See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
220228
*
221229
* @name Phaser.Tilemaps.DynamicTilemapLayer#cullCallback
222230
* @type {function}
223231
* @since 3.11.0
224232
*/
225-
this.cullCallback = TilemapComponents.CullTiles(this.layer.orientation);
226-
227-
// TODO ^^^
233+
this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation);
228234

229235
/**
230236
* The rendering (draw) order of the tiles in this layer.

src/tilemaps/staticlayer/StaticTilemapLayer.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,25 +223,33 @@ var StaticTilemapLayer = new Class({
223223
this.cullPaddingY = 1;
224224

225225
/**
226-
* Canvas only.
227-
*
228226
* The callback that is invoked when the tiles are culled.
229227
*
230-
* By default it will call `TilemapComponents.CullTiles` but you can override this to call any function you like.
228+
* For a Static Tilemap Layer this is only used for the Canvas Renderer.
229+
*
230+
* It will call a different function based on the map orientation:
231231
*
232-
* It will be sent 3 arguments:
232+
* Orthogonal (the default) is `TilemapComponents.CullTiles`
233+
* Isometric is `TilemapComponents.IsometricCullTiles`
234+
* Hexagonal is `TilemapComponents.HexagonalCullTiles`
235+
* Staggered is `TilemapComponents.StaggeredCullTiles`
236+
*
237+
* Howevr, you can override this to call any function you like.
238+
*
239+
* It will be sent 4 arguments:
233240
*
234241
* 1. The Phaser.Tilemaps.LayerData object for this Layer
235242
* 2. The Camera that is culling the layer. You can check its `dirty` property to see if it has changed since the last cull.
236243
* 3. A reference to the `culledTiles` array, which should be used to store the tiles you want rendered.
244+
* 4. The Render Order constant.
237245
*
238246
* See the `TilemapComponents.CullTiles` source code for details on implementing your own culling system.
239247
*
240248
* @name Phaser.Tilemaps.StaticTilemapLayer#cullCallback
241249
* @type {function}
242-
* @since 3.12.0
250+
* @since 3.11.0
243251
*/
244-
this.cullCallback = TilemapComponents.CullTiles;
252+
this.cullCallback = TilemapComponents.GetCullTilesFunction(this.layer.orientation);
245253

246254
/**
247255
* A reference to the renderer.

0 commit comments

Comments
 (0)