forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitmapText.js
More file actions
62 lines (45 loc) · 1.34 KB
/
Copy pathBitmapText.js
File metadata and controls
62 lines (45 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var Class = require('../../utils/Class');
var GameObject = require('../GameObject');
var Components = require('../../components');
var Render = require('./BitmapTextRender');
var BitmapText = new Class({
Mixins: [
Components.Transform,
Components.Texture,
Components.Size,
Components.Alpha,
Components.BlendMode,
Components.Visible,
Render
],
initialize:
function BitmapText (state, x, y, font, text, size, align)
{
if (text === undefined) { text = ''; }
if (size === undefined) { size = 32; }
if (align === undefined) { align = 'left'; }
GameObject.call(this, state);
this.fontData = this.state.sys.cache.bitmapFont.get(font);
this.text = text;
this.fontSize = size;
// Setting these will enable the Size component to work
// then anchorX etc will work too
// this.frame.realWidth = 0;
// this.frame.realHeight = 0;
this.displayCallback;
this.setTexture(font);
this.setPosition(x, y);
},
setDisplayCallback: function (callback)
{
this.displayCallback = callback;
return this;
},
setText: function (text)
{
// this._text = text;
// this.dirty = true;
return this;
}
});
module.exports = BitmapText;