A newline in DrawText?
BlitzMax Forums/BlitzMax Programming/A newline in DrawText?
| ||
How can I draw a new line in DrawText? I want to use DrawText for the credits in my game, but for some reason ~n doesn't seem to create a new line, like I expected it too. Can anybody help? |
| ||
You have to draw each line separately. |
| ||
Oh. That sucks. But thanks for responding. |
| ||
What would be cool is if drawtext put in a newline at the end of each statement IF there are no 'x,y' parameters; otherwise it would work as it does now. So that..DrawText "Line number one",0,0 ' Start at the top of the screen DrawText "Line number two" ' This one gets put right under the first one DrawText "Left side " + string_variable + " right side" ' Under line two DrawText "Line number four",200,0 ' This one is to the right of the first Anyway, it's not too much trouble to write a function that does this... Russell |
| ||
How about making a line typing type which you pass text to and that increases the Y coord ready for the next line (I did that). |
| ||
How about making a line typing type which you pass text to and that increases the Y coord ready for the next line (I did that). That's also what Wiering.bmfont does.You may want to take a peek at it too - do a forum search. |
| ||
Function DrawLines(txt$,x,y) For line$=EachIn txt.split("~n") DrawText line,x,y y:+TextHeight(line) Next Next |