home

2014년 8월 15일 금요일

[AndEngine] 10. Font 폰트

1. set font.

private Font mFont1;
private Font mFont2;

onCreateResources() {
    ....
    this.mFont1 = FontFactory.create(this.getFontManager(),
            this.getTextureManager(), 256, 256, Typeface.create(Typeface.DEFAULT, Typeface.BOLD, 32);
    this.mFont1.load();

    FontFactory.setAssetBasePath("font/");
    this.mFont2 = FontFactory.create(this.getFontManager(),
            this.getTextureManager(), 512, 512, Typeface.create(Typeface.BILINEAR, this.getAssets(), "Droid.ttf", 28, true, Color.WHITE);
    this.mFont2.load();
    ....
}

onCreateScene() {
    ...
    text = new Text(80, y, this.mFont1, content, content.length(), vertexBufferObjectManager);
}


2. display point.
//
leftText = new Text(80, 35, this.mFont, "0 Meter", "XXXX Meter".length(), vertexBufferObjectManager);
leftText.registerEntityModifier(new ScaleModifier(2, 0.0f, 1.0f));
scene.attachChild(leftText);

댓글 없음:

댓글 쓰기