A newline in DrawText?

BlitzMax Forums/BlitzMax Programming/A newline in DrawText?

zcbeaton(Posted 2008) [#1]
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?


GfK(Posted 2008) [#2]
You have to draw each line separately.


zcbeaton(Posted 2008) [#3]
Oh. That sucks. But thanks for responding.


Russell(Posted 2008) [#4]
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


Grey Alien(Posted 2008) [#5]
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).


plash(Posted 2008) [#6]
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.


Warpy(Posted 2008) [#7]
Function DrawLines(txt$,x,y)
  For line$=EachIn txt.split("~n")
    DrawText line,x,y
    y:+TextHeight(line)
  Next
Next