BitmapFont moved to extending RenderTexture instead of BitmapData. Now applied as a texture to a Sprite/Image.

This commit is contained in:
photonstorm
2014-02-14 13:50:50 +00:00
parent c3f306c795
commit ef95fbaa00
4 changed files with 113 additions and 47 deletions
+17 -7
View File
@@ -9,12 +9,22 @@ function preload() {
}
var font;
var i;
function create() {
font = game.add.bitmapFont(game.world.centerX, 300, 'knightHawks', 31, 25, Phaser.BitmapFont.TEXT_SET6, 10, 1, 1);
font.anchor.set(0.5);
font = game.add.bitmapFont('knightHawks', 31, 25, Phaser.BitmapFont.TEXT_SET6, 10, 1, 1);
font.text = 'phaser was here';
for (var c = 0; c < 10; c++)
{
var i = game.add.image(0, c * 32, font);
i.tint = Math.random() * 0xFFFFFF;
}
// i.scale.set(2);
// font.anchor.set(0.5);
// font.text = 'phaser';
game.input.onDown.add(change, this);
@@ -23,21 +33,21 @@ function create() {
function change() {
font.tint = Math.random() * 0xFFFFFF;
font.text = 'rocking the house';
}
function update() {
// font.text = "phaser\n\nx: " + game.input.x + "\ny: " + game.input.y;
font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
// font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
}
function render() {
game.debug.renderText("x: " + game.input.x + "\ny: " + game.input.y, 32, 32);
game.debug.renderText(font.bmd.width + " x " + font.bmd.height, 32, 64);
game.debug.renderText(font.width + " x " + font.height, 32, 96);
// game.debug.renderText("x: " + game.input.x + "\ny: " + game.input.y, 32, 32);
// game.debug.renderText(font.bmd.width + " x " + font.bmd.height, 32, 64);
// game.debug.renderText(font.width + " x " + font.height, 32, 96);
}