How to create a NEW-LINE using font.DrawText(...)?

Post your work in progress addons and get feedback

Post » Fri Feb 06, 2015 8:29 am

(Sorry about double post, if a mod could merge my other post that would be great!)

Is it possible to pass some "special-character" to create a new line for the EditTime method: font.DrawText? I know that "\n" doesn't work, and neither does anything else I've tried. Anyone know if this is possible?

I wanna do this for example:

Code: Select all
this.font.DrawText("Hello \n World",
                        this.instance.GetBoundingQuad(),
                        this.properties["Color"],
                        halign,
                        this.instance.GetOpacity(),
                        this.instance.GetAngle(),
                        (this.properties["Wrapping"] === "Word"),
                        this.properties["Line height"],
                        valign);

Wanted output:
Code: Select all
Hello
World

Received output:
Code: Select all
Hello [?] World



EDIT:
I already know that I can create a new line by writing: & newline &, this is NOT what I'm after. I want to be able to do newline in edit-time, in other words, render a new-line inside the editor (not by pressing F5).

@Ashley mind answering if this is even possible? It all comes down to how the font.DrawText is implemented.
Last edited by Whyser on Sun Feb 08, 2015 7:04 pm, edited 1 time in total.
B
4
Posts: 12
Reputation: 224

Post » Fri Feb 06, 2015 5:33 pm

If you know you need a new line in your text, you could use the built-in newline object:

"Hello" & newline & "World!"

This would take a little more thought if you are creating the string on the fly.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Sun Feb 08, 2015 7:02 pm

FragFather wrote:If you know you need a new line in your text, you could use the built-in newline object:

"Hello" & newline & "World!"

This would take a little more thought if you are creating the string on the fly.


I'm asking how to do it using the method I mentioned since I'm creating a plugin.
B
4
Posts: 12
Reputation: 224


Return to Work in Progress Addons

Who is online

Users browsing this forum: Cryttexx and 0 guests