2017-07-04 00:59:31 +00:00
|
|
|
var BitmapText = require('./DynamicBitmapText');
|
|
|
|
var BuildGameObject = require('../../BuildGameObject');
|
2017-09-14 01:27:29 +00:00
|
|
|
var GameObjectCreator = require('../../../scene/plugins/GameObjectCreator');
|
|
|
|
var GetAdvancedValue = require('../../../utils/object/GetAdvancedValue');
|
2017-07-04 00:59:31 +00:00
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
// When registering a factory function 'this' refers to the GameObjectCreator context.
|
|
|
|
|
|
|
|
GameObjectCreator.register('dynamicBitmapText', function (config)
|
2017-07-04 00:59:31 +00:00
|
|
|
{
|
|
|
|
var font = GetAdvancedValue(config, 'font', '');
|
|
|
|
var text = GetAdvancedValue(config, 'text', '');
|
|
|
|
var size = GetAdvancedValue(config, 'size', false);
|
|
|
|
var align = GetAdvancedValue(config, 'align', 'left');
|
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
var bitmapText = new BitmapText(this.scene, 0, 0, font, text, size, align);
|
2017-07-04 00:59:31 +00:00
|
|
|
|
2017-09-14 01:27:29 +00:00
|
|
|
BuildGameObject(this.scene, bitmapText, config);
|
2017-07-04 00:59:31 +00:00
|
|
|
|
|
|
|
return bitmapText;
|
2017-09-14 01:27:29 +00:00
|
|
|
});
|