mirror of
https://github.com/wassname/phaser.git
synced 2026-08-13 12:30:11 +08:00
BitmapFont moved to extending RenderTexture instead of BitmapData. Now applied as a texture to a Sprite/Image.
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user