SFML community forums

Help => General => Topic started by: helpmeplease on June 18, 2020, 02:02:41 pm

Title: Array of texts with indentations
Post by: helpmeplease on June 18, 2020, 02:02:41 pm
Hello! I'm just starting out in SFML and I need your help. I'm trying to display a conversation between two people but the texts will have different indentations, for example:

          Hello, how are you?
                                           Good thanks! you?
          Meh.

Something like that, any ideas how I can do that?
Title: Re: Array of texts with indentations
Post by: Hapax on June 18, 2020, 06:22:03 pm
It each line is its own text object, simply change its horizontal position.
If you need it "right-aligned", you'll need to make some calculations; simplest option is to just move the origin to the right-hand side and then position the text on the right-edge.

If everything is one text object, you'll need to pad the beginning of certain lines with spaces (or tabs). This is less accurate since spaces are fixed but if it's just indentation you're after, this could work.