转:AndEngine中的字体加载及应用

AndEngine中的字体加载及应用

 

 

 

AndEngine中的字体加载及应用

public void onLoadResources() {


this.mTexture1 = new Texture(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
FontFactory.setAssetBasePath("font/");
this.mPlokFont = FontFactory.createFromAsset(this.mTexture1, this, "Plok.ttf", 30, true, Color.BLACK);
this.mEngine.getTextureManager().loadTexture(this.mTexture1);
this.mEngine.getFontManager().loadFonts(this.mPlokFont);
}


public Scene onLoadScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());


final Scene scene = new Scene(1);
scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));


scene.getTopLayer().addEntity(new Text(140, 300, this.mPlokFont, "hello!"));


return scene;
}

 

 

 

转自:http://361tg.net/read.php?17

你可能感兴趣的:(AndEngine)