Vishal
Vishal

Reputation: 160

How can I use libgdx BitmapFont draw method to write text of specific font style and size.

I have tried the code given below:

Assets.font.draw(objspritebatch, chooseBackground, Gdx.graphics.getWidth()*.5f,Gdx.graphics.getHeight()*.5f);

Upvotes: 0

Views: 2286

Answers (1)

Daniel Jonsson
Daniel Jonsson

Reputation: 3931

If you are going to draw text, it's probably in the game's HUD or in the menus. Then you should check out scene2d, and especially the scene2d.ui widget Label. And don't forget to explore the API.

However, to simply draw text on the screen, check out this wiki article. If you want to use your own custom font, you will need to package it with Hiero.

Upvotes: 2

Related Questions