forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathText.js
More file actions
28 lines (18 loc) · 689 Bytes
/
Copy pathText.js
File metadata and controls
28 lines (18 loc) · 689 Bytes
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
Phaser.Text = function (game, x, y, text, style) {
x = x || 0;
y = y || 0;
text = text || '';
style = style || '';
this.canvas = document.createElement("canvas");
this.context = this.canvas.getContext("2d");
var canvasID = game.rnd.uuid();
PIXI.TextureCache[canvasID] = new PIXI.Texture(new PIXI.BaseTexture(this.canvas));
Phaser.Sprite.call(this, game, x, y, canvasID);
this.setText(text);
this.setStyle(style);
this.updateText();
this.dirty = false;
};
Phaser.Text.prototype = Phaser.Utils.extend(true, Phaser.Sprite.prototype, PIXI.Text.prototype);
Phaser.Text.prototype.constructor = Phaser.Text;
// Add our own custom methods