phaser/src/tilemaps/parsers/FromOrientationString.js

42 lines
969 B
JavaScript
Raw Normal View History

2020-11-23 15:29:08 +00:00
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var CONST = require('../const/ORIENTATION_CONST');
2020-11-23 15:29:08 +00:00
/**
* Get the Tilemap orientation from the given string.
*
* @function Phaser.Tilemaps.Parsers.FromOrientationString
2020-11-23 15:29:08 +00:00
* @since 3.50.0
*
* @param {string} [orientation] - The orientation type as a string.
*
2020-11-23 15:32:30 +00:00
* @return {Phaser.Tilemaps.OrientationType} The Tilemap Orientation type.
2020-11-23 15:29:08 +00:00
*/
var FromOrientationString = function (orientation)
{
orientation = orientation.toLowerCase();
if (orientation === 'isometric')
{
return CONST.ISOMETRIC;
}
else if (orientation === 'staggered')
{
return CONST.STAGGERED;
}
else if (orientation === 'hexagonal')
{
return CONST.HEXAGONAL;
}
else
{
return CONST.ORTHOGONAL;
}
};
module.exports = FromOrientationString;