Implementing a scrolling text box
Posted: Thu May 12, 2016 4:48 am
Hey all... complete LÖVE newbie here, so apologies in advance if this is a dumb question.
I've been learning LÖVE by using it to build out a game idea that's been rattling around in my head forever. For the most part it's super easy to pick up, which is great. However there is one element of the game where I can't figure out what the right way is to implement it. So I figured I'd ask the experts
It seems like it should be simple: a text area/pane/panel that can accept an arbitrary amount of text, that offers a scroll bar when the text fills the box, and has old text scroll away and be replaced by new text as it comes in. (The idea is to have a little textual log that runs in a portion of the screen, with flavor text getting dropped into it as various events happen.)
LÖVE's built in tools for working with text are fine for printing things like labels, but they don't seem to be geared for this type of task, where there's going to be an unknown quantity of text flowing through the element. And I haven't found any libraries that add this kind of widget either. (I'm using SUIT for the UI, and it's great for what it is but it doesn't address this either.)
If you're familiar with LibGDX, what I'm thinking of here is something like Scene2D's TextArea control. Just a big dumb text area I can set to a particular width and height and then append text to as it's needed, without having to treat each bit of text as a special snowflake that needs to be individually formatted, positioned, etc.
I guess I could write my own control, but if such a thing already exists somewhere in LÖVEland I'd certainly rather just pick it up and use it so I can get back to working on the actual game. Anyone have any pointers/advice they can share?
Thanks in advance!
I've been learning LÖVE by using it to build out a game idea that's been rattling around in my head forever. For the most part it's super easy to pick up, which is great. However there is one element of the game where I can't figure out what the right way is to implement it. So I figured I'd ask the experts
It seems like it should be simple: a text area/pane/panel that can accept an arbitrary amount of text, that offers a scroll bar when the text fills the box, and has old text scroll away and be replaced by new text as it comes in. (The idea is to have a little textual log that runs in a portion of the screen, with flavor text getting dropped into it as various events happen.)
LÖVE's built in tools for working with text are fine for printing things like labels, but they don't seem to be geared for this type of task, where there's going to be an unknown quantity of text flowing through the element. And I haven't found any libraries that add this kind of widget either. (I'm using SUIT for the UI, and it's great for what it is but it doesn't address this either.)
If you're familiar with LibGDX, what I'm thinking of here is something like Scene2D's TextArea control. Just a big dumb text area I can set to a particular width and height and then append text to as it's needed, without having to treat each bit of text as a special snowflake that needs to be individually formatted, positioned, etc.
I guess I could write my own control, but if such a thing already exists somewhere in LÖVEland I'd certainly rather just pick it up and use it so I can get back to working on the actual game. Anyone have any pointers/advice they can share?
Thanks in advance!