libgdx BitMapFont not working -


i trying use bitmapfont in libgdx based game.i this:

bitmapfont font; this.font = new bitmapfont(); render{     gdx.gl.glclearcolor(0x64 / 255.0f, 0x95 / 255.0f, 0xed / 255.0f,             0xff / 255.0f);     gdx.gl.glclear(gl20.gl_color_buffer_bit);     gdx.app.log(tag, " fps: " + gdx.graphics.getframespersecond());      batch.setprojectionmatrix(cameramanager.camera.combined);     batch.begin();     font.setcolor(color.black);     font.draw(batch, "time", 4, 4);     batch.end(); } 

and camera managed as:

public class cameramanager {  public static orthographiccamera camera;  public cameramanager(){     camera = new orthographiccamera(constants.viewport_width, constants.viewport_height);     camera.viewportwidth = (camera.viewportheight)             * ((float) gdx.graphics.getwidth() / (float) gdx.graphics             .getheight());     camera.position.set(camera.viewportwidth / 2,             camera.viewportheight / 2, 0);     camera.update(); }  public void resize(int width, int height) {     camera.viewportwidth = (camera.viewportheight)             * ((float) width / (float) height);     camera.update(); } 

}

but instead of text, several rectangles displayed color color pass setcolor().i have no idea whats happening here. of tutorials use simple piece of code.but not working me.

please advise.

i recommend downloading .ttf fonts , passing them in bitmap font object

bitmapfont font = new bitmapfont(gdx.files.internal("fontfile.ttf")); 

here lot of great .ttf fonts can download https://www.google.com/fonts


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -