BitmapFont fixes and updates and Cache support for it added. Working sweet now.

This commit is contained in:
photonstorm
2014-02-14 16:38:06 +00:00
parent ef95fbaa00
commit 539a0f2256
5 changed files with 58 additions and 34 deletions
+6 -27
View File
@@ -1,6 +1,6 @@
// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render });
// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
function preload() {
@@ -16,38 +16,17 @@ function create() {
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++)
for (var c = 0; c < 19; c++)
{
var i = game.add.image(0, c * 32, font);
var i = game.add.image(game.world.centerX, c * 32, font);
i.tint = Math.random() * 0xFFFFFF;
i.anchor.set(0.5, 1);
}
// i.scale.set(2);
// font.anchor.set(0.5);
// font.text = 'phaser';
game.input.onDown.add(change, this);
}
function change() {
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;
}
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);
font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
}