2017-07-11 23:49:20 +00:00
|
|
|
var ParseXMLBitmapFont = require('./ParseXMLBitmapFont');
|
|
|
|
|
2017-07-14 13:30:20 +00:00
|
|
|
var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xSpacing, ySpacing)
|
2017-07-11 23:49:20 +00:00
|
|
|
{
|
2017-07-14 13:30:20 +00:00
|
|
|
var frame = scene.sys.textures.getFrame(textureKey, frameKey);
|
|
|
|
var xml = scene.sys.cache.xml.get(xmlKey);
|
2017-07-11 23:49:20 +00:00
|
|
|
|
|
|
|
if (frame && xml)
|
|
|
|
{
|
|
|
|
var data = ParseXMLBitmapFont(xml, xSpacing, ySpacing, frame);
|
|
|
|
|
2017-07-14 13:30:20 +00:00
|
|
|
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
|
2017-07-11 23:49:20 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = ParseFromAtlas;
|