Added the new BitmapFont class. This is for rendering retro style fixed-width bitmap fonts into an Image object.

This commit is contained in:
photonstorm
2014-02-14 06:04:29 +00:00
parent b38b00c2c1
commit 15b83e1c88
9 changed files with 597 additions and 10 deletions
+27
View File
@@ -144,6 +144,27 @@ Phaser.BitmapData.prototype = {
},
/**
* Resizes the BitmapData.
* @method Phaser.BitmapData#resize
*/
resize: function (width, height) {
if (width !== this.width || height !== this.height)
{
this.width = width;
this.height = height;
this.canvas.width = width;
this.canvas.height = height;
this.textureFrame.width = width;
this.textureFrame.height = height;
this.imageData = this.context.getImageData(0, 0, width, height);
}
this._dirty = true;
},
refreshBuffer: function () {
this.imageData = this.context.getImageData(0, 0, this.width, this.height);
@@ -246,6 +267,12 @@ Phaser.BitmapData.prototype = {
},
copyPixels: function (source, area, destX, destY) {
this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height);
},
/**
* If the game is running in WebGL this will push the texture up to the GPU if it's dirty.
* This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function.