Skip to content

Commit 2537e3f

Browse files
committed
Tilemaps.Components.GetWorldToTileXFunction is a new function that returns the correct conversion function to use.
1 parent 3352bd8 commit 2537e3f

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2020 Photon Storm Ltd.
4+
* @license {@link https://opensource.org/licenses/MIT|MIT License}
5+
*/
6+
7+
var CONST = require('../const');
8+
var NOOP = require('../../utils/NOOP');
9+
var WorldToTileX = require('./WorldToTileX');
10+
11+
/**
12+
* Gets the correct function to use to translate tiles, based on the map orientation.
13+
*
14+
* @function Phaser.Tilemaps.Components.GetWorldToTileXFunction
15+
* @since 3.50.0
16+
*
17+
* @param {number} orientation - The Tilemap orientation constant.
18+
*
19+
* @return {Phaser.Tilemaps.Components.WorldToTileX)} The function to use to translate tiles for the given map type.
20+
*/
21+
var GetWorldToTileXFunction = function (orientation)
22+
{
23+
if (orientation === CONST.ORTHOGONAL)
24+
{
25+
return WorldToTileX;
26+
}
27+
else
28+
{
29+
return NOOP;
30+
}
31+
};
32+
33+
module.exports = GetWorldToTileXFunction;

0 commit comments

Comments
 (0)