From fb713ab5ecf875c9842d67b9f2c40653563070c4 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Mon, 24 Jul 2017 14:07:38 +0100 Subject: [PATCH] Added tint component to Bitmap Text. --- v3/src/checksum.js | 2 +- .../bitmaptext/dynamic/DynamicBitmapText.js | 19 +++++++++++++------ .../bitmaptext/static/BitmapText.js | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/v3/src/checksum.js b/v3/src/checksum.js index 2835184df..e9514b4fd 100644 --- a/v3/src/checksum.js +++ b/v3/src/checksum.js @@ -1,4 +1,4 @@ var CHECKSUM = { -build: '274ce990-6e15-11e7-a303-3f21b9a8d9b0' +build: '9bfd8260-7070-11e7-a8ad-036eabaeebad' }; module.exports = CHECKSUM; \ No newline at end of file diff --git a/v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js b/v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js index 73f0e25bf..35524aed4 100644 --- a/v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js +++ b/v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js @@ -14,6 +14,7 @@ var DynamicBitmapText = new Class({ Components.Origin, Components.RenderTarget, Components.Texture, + Components.Tint, Components.Transform, Components.Visible, Components.ScrollFactor, @@ -22,19 +23,28 @@ var DynamicBitmapText = new Class({ initialize: - function DynamicBitmapText (scene, x, y, font, text, size, align) + function DynamicBitmapText (scene, x, y, font, text, size) { if (text === undefined) { text = ''; } - if (align === undefined) { align = 'left'; } 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.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.scrollY = 0; @@ -42,9 +52,6 @@ var DynamicBitmapText = new Class({ this.height = 0; this.displayCallback; - - this.setTexture(font); - this.setPosition(x, y); }, setSize: function (width, height) diff --git a/v3/src/gameobjects/bitmaptext/static/BitmapText.js b/v3/src/gameobjects/bitmaptext/static/BitmapText.js index bc2f5711a..61d296531 100644 --- a/v3/src/gameobjects/bitmaptext/static/BitmapText.js +++ b/v3/src/gameobjects/bitmaptext/static/BitmapText.js @@ -17,6 +17,7 @@ var BitmapText = new Class({ Components.RenderTarget, Components.ScaleMode, Components.Texture, + Components.Tint, Components.Transform, Components.Visible, Components.ScrollFactor,