BitmapText, both static and dynamic, can now take any data-type, including numbers, for the text argument in the constructor. Before they only worked via setText

This commit is contained in:
Richard Davey 2018-05-03 15:52:12 +01:00
parent 47f647206f
commit 107ca71d6b
3 changed files with 7 additions and 2 deletions

View file

@ -69,6 +69,7 @@ The Loader has been given an overhaul to improve its performance and extensibili
* ScenePlugin.setActive would only toggle the current Scene, not any given Scene.
* ScenePlugin.setVisible would only toggle the current Scene, not any given Scene.
* The Graphics Creator would automatically add the Graphics to the display list by mistake. The default should be to remain hidden. Fix #3637 (thanks @mikuso)
* BitmapText, both static and dynamic, can now take any data-type, including numbers, for the `text` argument in the constructor. Before they only worked via `setText` (thanks @Jelaw21)
### Examples, Documentation and TypeScript

View file

@ -111,7 +111,7 @@ var DynamicBitmapText = new Class({
* @type {string}
* @since 3.0.0
*/
this.text = (Array.isArray(text)) ? text.join('\n') : text;
this.text = '';
/**
* [description]
@ -132,6 +132,8 @@ var DynamicBitmapText = new Class({
*/
this.letterSpacing = 0;
this.setText(text);
this.setTexture(entry.texture, entry.frame);
this.setPosition(x, y);
this.setOrigin(0, 0);

View file

@ -121,7 +121,7 @@ var BitmapText = new Class({
* @type {string}
* @since 3.0.0
*/
this.text = (Array.isArray(text)) ? text.join('\n') : text;
this.text = '';
/**
* [description]
@ -142,6 +142,8 @@ var BitmapText = new Class({
*/
this.letterSpacing = 0;
this.setText(text);
this.setTexture(entry.texture, entry.frame);
this.setPosition(x, y);
this.setOrigin(0, 0);