11var Class = require ( '../../../utils/Class' ) ;
2- var GameObject = require ( '../../GameObject' ) ;
32var Components = require ( '../../components' ) ;
4- var Render = require ( './BitmapTextRender ' ) ;
3+ var GameObject = require ( '../../GameObject ' ) ;
54var GetBitmapTextSize = require ( '../GetBitmapTextSize' ) ;
5+ var ParseFromAtlas = require ( '../ParseFromAtlas' ) ;
66var ParseRetroFont = require ( '../ParseRetroFont' ) ;
7+ var Render = require ( './BitmapTextRender' ) ;
78
89var BitmapText = new Class ( {
910
@@ -25,21 +26,23 @@ var BitmapText = new Class({
2526
2627 initialize :
2728
28- function BitmapText ( state , x , y , font , text , size , align )
29+ function BitmapText ( state , x , y , font , text , size )
2930 {
3031 if ( text === undefined ) { text = '' ; }
31- if ( align === undefined ) { align = 'left' ; }
3232
3333 GameObject . call ( this , state , 'BitmapText' ) ;
3434
3535 this . font = font ;
36- this . fontData = this . state . sys . cache . bitmapFont . get ( font ) ;
36+
37+ var entry = this . state . sys . cache . bitmapFont . get ( font ) ;
38+
39+ this . fontData = entry . data ;
3740
3841 this . text = ( Array . isArray ( text ) ) ? text . join ( '\n' ) : text ;
3942
4043 this . fontSize = size || this . fontData . size ;
4144
42- this . setTexture ( font ) ;
45+ this . setTexture ( entry . texture , entry . frame ) ;
4346 this . setPosition ( x , y ) ;
4447 this . setOrigin ( 0 , 0 ) ;
4548 } ,
@@ -101,5 +104,6 @@ var BitmapText = new Class({
101104} ) ;
102105
103106BitmapText . ParseRetroFont = ParseRetroFont ;
107+ BitmapText . ParseFromAtlas = ParseFromAtlas ;
104108
105109module . exports = BitmapText ;
0 commit comments