mirror of
https://github.com/wassname/phaser.git
synced 2026-07-25 13:20:14 +08:00
Added the new BitmapFont class. This is for rendering retro style fixed-width bitmap fonts into an Image object.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user