Hello Guest

Drawing dynamic-sized textboxes

  • 1 Replies
  • 5321 Views
Drawing dynamic-sized textboxes
« on: August 28, 2018, 15:27:24 »
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.

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: Drawing dynamic-sized textboxes
« Reply #1 on: August 28, 2018, 20:04:22 »
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.