Skip to content

Commit 107ca71

Browse files
committed
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
1 parent 47f6472 commit 107ca71

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ The Loader has been given an overhaul to improve its performance and extensibili
6969
* ScenePlugin.setActive would only toggle the current Scene, not any given Scene.
7070
* ScenePlugin.setVisible would only toggle the current Scene, not any given Scene.
7171
* 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)
72+
* 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)
7273

7374
### Examples, Documentation and TypeScript
7475

src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ var DynamicBitmapText = new Class({
111111
* @type {string}
112112
* @since 3.0.0
113113
*/
114-
this.text = (Array.isArray(text)) ? text.join('\n') : text;
114+
this.text = '';
115115

116116
/**
117117
* [description]
@@ -132,6 +132,8 @@ var DynamicBitmapText = new Class({
132132
*/
133133
this.letterSpacing = 0;
134134

135+
this.setText(text);
136+
135137
this.setTexture(entry.texture, entry.frame);
136138
this.setPosition(x, y);
137139
this.setOrigin(0, 0);

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ var BitmapText = new Class({
121121
* @type {string}
122122
* @since 3.0.0
123123
*/
124-
this.text = (Array.isArray(text)) ? text.join('\n') : text;
124+
this.text = '';
125125

126126
/**
127127
* [description]
@@ -142,6 +142,8 @@ var BitmapText = new Class({
142142
*/
143143
this.letterSpacing = 0;
144144

145+
this.setText(text);
146+
145147
this.setTexture(entry.texture, entry.frame);
146148
this.setPosition(x, y);
147149
this.setOrigin(0, 0);

0 commit comments

Comments
 (0)