Added tint component to Bitmap Text.

This commit is contained in:
photonstorm 2017-07-24 14:07:38 +01:00
parent 9bd93f36b2
commit fb713ab5ec
3 changed files with 15 additions and 7 deletions

View file

@ -1,4 +1,4 @@
var CHECKSUM = { var CHECKSUM = {
build: '274ce990-6e15-11e7-a303-3f21b9a8d9b0' build: '9bfd8260-7070-11e7-a8ad-036eabaeebad'
}; };
module.exports = CHECKSUM; module.exports = CHECKSUM;

View file

@ -14,6 +14,7 @@ var DynamicBitmapText = new Class({
Components.Origin, Components.Origin,
Components.RenderTarget, Components.RenderTarget,
Components.Texture, Components.Texture,
Components.Tint,
Components.Transform, Components.Transform,
Components.Visible, Components.Visible,
Components.ScrollFactor, Components.ScrollFactor,
@ -22,19 +23,28 @@ var DynamicBitmapText = new Class({
initialize: initialize:
function DynamicBitmapText (scene, x, y, font, text, size, align) function DynamicBitmapText (scene, x, y, font, text, size)
{ {
if (text === undefined) { text = ''; } if (text === undefined) { text = ''; }
if (align === undefined) { align = 'left'; }
GameObject.call(this, scene, 'DynamicBitmapText'); GameObject.call(this, scene, 'DynamicBitmapText');
this.fontData = this.scene.sys.cache.bitmapFont.get(font); this.font = font;
var entry = this.scene.sys.cache.bitmapFont.get(font);
this.fontData = entry.data;
this.text = (Array.isArray(text)) ? text.join('\n') : text; this.text = (Array.isArray(text)) ? text.join('\n') : text;
this.fontSize = size || this.fontData.size; this.fontSize = size || this.fontData.size;
this.setTexture(entry.texture, entry.frame);
this.setPosition(x, y);
this.setOrigin(0, 0);
this._bounds = this.getTextBounds();
this.scrollX = 0; this.scrollX = 0;
this.scrollY = 0; this.scrollY = 0;
@ -42,9 +52,6 @@ var DynamicBitmapText = new Class({
this.height = 0; this.height = 0;
this.displayCallback; this.displayCallback;
this.setTexture(font);
this.setPosition(x, y);
}, },
setSize: function (width, height) setSize: function (width, height)

View file

@ -17,6 +17,7 @@ var BitmapText = new Class({
Components.RenderTarget, Components.RenderTarget,
Components.ScaleMode, Components.ScaleMode,
Components.Texture, Components.Texture,
Components.Tint,
Components.Transform, Components.Transform,
Components.Visible, Components.Visible,
Components.ScrollFactor, Components.ScrollFactor,