Phaser.BitmapText = function (game, x, y, font, text, size){ x = x || 0; y = y || 0; font = font || ''; text = text || ''; size = size || 32; this.type = Phaser.BITMAPTEXT; this._text = text; this._font = font; this._fontSize = size; this._align = 'left'; this._tint = 16777215; PIXI.BitmapText.call(this, text); Phaser.Component.Core.init.call(this, game, x, y, '', null ); } ; Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype); Phaser.BitmapText.prototype.constructor = Phaser.BitmapText; var components = ['Angle', 'AutoCull', 'Bounds', 'Destroy', 'FixedToCamera', 'InputEnabled', 'InWorld', 'LifeSpan', 'PhysicsBody', 'Reset'] ; Phaser.Component.Core.install.call(Phaser.BitmapText.prototype, components); Phaser.BitmapText.prototype.setStyle = function (){ this.style = { align: this._align} ; this.fontName = this._font; this.fontSize = this._fontSize; this.dirty = true ; } ; Phaser.BitmapText.prototype.preUpdate = function (){ Phaser.Component.InWorld.preUpdate.call(this); Phaser.Component.Core.preUpdate.call(this); return true ; } ; Phaser.BitmapText.prototype.postUpdate = function (){ Phaser.Component.PhysicsBody.postUpdate.call(this); Phaser.Component.FixedToCamera.postUpdate.call(this); } ; Object.defineProperty(Phaser.BitmapText.prototype, 'align', { get: function (){ return this._align; } , set: function (value){ if (value !== this._align) { this._align = value; this.setStyle(); } } } ); Object.defineProperty(Phaser.BitmapText.prototype, 'tint', { get: function (){ return this._tint; } , set: function (value){ if (value !== this._tint) { this._tint = value; this.dirty = true ; } } } ); Object.defineProperty(Phaser.BitmapText.prototype, 'font', { get: function (){ return this._font; } , set: function (value){ if (value !== this._font) { this._font = value.trim(); this.fontName = this._font; this.style.font = this._fontSize + "px '" + this._font + "'"; this.dirty = true ; } } } ); Object.defineProperty(Phaser.BitmapText.prototype, 'fontSize', { get: function (){ return this._fontSize; } , set: function (value){ value = parseInt(value, 10); if (value !== this._fontSize) { this._fontSize = value; this.style.font = this._fontSize + "px '" + this._font + "'"; this.dirty = true ; } } } ); Object.defineProperty(Phaser.BitmapText.prototype, 'text', { get: function (){ return this._text; } , set: function (value){ if (value !== this._text) { this._text = value.toString() || ' '; this.dirty = true ; } } } );