Drawing dynamic-sized textboxes

Started by KLMNT, August 28, 2018, 15:27:24

Previous topic - Next topic


Context: I want to render some text on top of a texture, much like in the old pokemon games, where character appeared one after another and you could click in order to skip that animation and make appear the whole text.
The problem comes when i try to render that text dynamically, so i donÃ,´t have to determine by myself where to insert the \nÃ,´s manually, since the game IÃ,´m making will have a lot of text.
My question is the following,
Is there a way either LWJGL or Slick can help me drawing a textbox with several lines of text in a way that it knows its own size and hence, when to insert a \n, or will I have to come up with a solution of my own?
I know I can do it, itÃ,´s just I wouldnÃ,´t like to be wasting time in that and later discover that there was already a way to do it way faster and simpler.


LWJGL does not do that out of the box. You have to use stb_truetype font metrics and do the text layout yourself.

You could look around for an open source solution, I'm sure several LWJGL users have implemented it by now.