Multi Line Text

BlitzPlus Forums/BlitzPlus Programming/Multi Line Text

xmlspy(Posted 2005) [#1]
Ok, I'm making a message system for a game, but I'm facing some problems. How do I do correct multi line text based on the width of the window?

I don't want my string to keep going to the right when using the Text command. When it reaches the end of the window then start a new line and continue where I left of.


CS_TBL(Posted 2005) [#2]
Make a format function, which formats a string (strings can be any length) to any given width and
- auto wraps words
- puts a whole word on a new line when it doesn't fit the line anymore

You could do something like that with a bank, the banksize is the givin width of a line * the amount of lines it will eventually take. Naturally you start with 1 line, and when a new line needs to be created you resize the bank again.

When you're done, use this bank to read the chars from and build-up the screen.

example:

bank=FormatText$(txt$,width)

and:

Drawtext(bank)