Text converted and a couple of examples created. Using new extend system, so much smaller classes now.

This commit is contained in:
Richard Davey
2013-09-03 06:02:47 +01:00
parent 5acb4e9f1b
commit 8a90a87492
9 changed files with 124 additions and 34 deletions
+28
View File
@@ -0,0 +1,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