mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 17:16:03 +00:00
35 lines
872 B
JavaScript
35 lines
872 B
JavaScript
/**
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
*/
|
|
|
|
var ParseXMLBitmapFont = require('./ParseXMLBitmapFont');
|
|
|
|
/**
|
|
* [description]
|
|
*
|
|
* @function ParseFromAtlas
|
|
* @since 3.0.0
|
|
* @private
|
|
*/
|
|
var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing)
|
|
{
|
|
var frame = scene.sys.textures.getFrame(textureKey, frameKey);
|
|
var xml = scene.sys.cache.xml.get(xmlKey);
|
|
|
|
if (frame && xml)
|
|
{
|
|
var data = ParseXMLBitmapFont(xml, xSpacing, ySpacing, frame);
|
|
|
|
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
};
|
|
|
|
module.exports = ParseFromAtlas;
|