Testing BitmapFont as a texture.

This commit is contained in:
photonstorm
2014-02-14 12:07:04 +00:00
parent 7d2a818d0d
commit c3f306c795
4 changed files with 126 additions and 4 deletions
+4
View File
@@ -152,6 +152,7 @@ Phaser.BitmapData.prototype = {
if (width !== this.width || height !== this.height)
{
console.log('bmd resize', width, height);
this.width = width;
this.height = height;
this.canvas.width = width;
@@ -165,6 +166,9 @@ Phaser.BitmapData.prototype = {
},
/**
* @method Phaser.BitmapData#refreshBuffer
*/
refreshBuffer: function () {
this.imageData = this.context.getImageData(0, 0, this.width, this.height);
+10 -4
View File
@@ -135,7 +135,8 @@ Phaser.BitmapFont = function (game, x, y, key, characterWidth, characterHeight,
/**
* @property {Phaser.BitmapData} bmd - The internal BitmapData to which the font is rendered.
*/
this.bmd = new Phaser.BitmapData(game, this.characterWidth, this.characterHeight);
// this.bmd = new Phaser.BitmapData(game, this.characterWidth, this.characterHeight);
this.bmd = new Phaser.BitmapData(game, 800, 600);
Phaser.Image.call(this, game, x, y, this.bmd);
@@ -386,9 +387,14 @@ Phaser.BitmapFont.prototype.buildBitmapFontText = function () {
}
this.bmd.render();
this.width = this.bmd.width;
this.height = this.bmd.height;
this.texture.frame.width = this.bmd.width;
this.texture.frame.height = this.bmd.height;
this.updateFrame = true;
this.dirty = true;
this.textureChange = true;
// this.setTexture(this.bmd.texture);
// this.width = this.bmd.width;
// this.height = this.bmd.height;
}