Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX . draw multiline text

I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically and show whole text on the screen ?

like image 648
Vahe Muradyan Avatar asked Aug 22 '14 08:08

Vahe Muradyan


1 Answers

Either use \n for manual new lines and render the font via font.drawMultiLine(...).

Or use font.drawWrapped(...) with a wrap width to let libgdx wrap it automatically (manually added \n are still supported).

Update:
With libGDX 1.6 the draw methods were enhanced, and there is no further need for drawMultiLine and drawWrapped, so those were removed. Draw methods can handle multiple lines and a new boolean wrap parameter was introduced.

like image 196
noone Avatar answered Oct 03 '22 23:10

noone