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

Get help using Construct 2

Post » Thu Feb 05, 2015 9:17 am

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



Thank you!
B
4
Posts: 12
Reputation: 224

Post » Thu Feb 05, 2015 11:21 am

@Whyser
Try newline
You can find it in "System Expressions"
B
12
S
1
Posts: 84
Reputation: 1,487

Post » Thu Feb 05, 2015 12:31 pm

Thanks, but that's not what I'm after. I'm writing a Plugin and need to be able to create a new-line using the "font.DrawText(...)" method (in edittime.js). As I can't see how the DrawText(...) is implemented under the hood, I can't find out how to accomplish this.

@Ashley is probably the only one who can answer this, or someone that asked him and got the answer.
B
4
Posts: 12
Reputation: 224

Post » Thu Feb 05, 2015 12:38 pm

@Whyser
Oh, wow, cool man Good luck.
May I know what is the plug-in are you working on?
B
12
S
1
Posts: 84
Reputation: 1,487

Post » Thu Feb 05, 2015 12:42 pm

Would be best if this is either reposted or moved (hail a mod) to the Work in Progress Addons section.

It would stand a much better chance of attracting the type of help you require.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
134
S
30
G
84
Posts: 5,387
Reputation: 58,456

Post » Thu Feb 05, 2015 1:52 pm

newlee wrote:Oh, wow, cool man Good luck.
May I know what is the plug-in are you working on?

Nothing fancy really, just a plugin based on the Text-object so that one is able to use "\n" to create new lines and preview them inside Construct (not F5). Currently if you type default text into the Text-field of the Text-object it's impossible to get new lines.


zenox98 wrote:Would be best if this is either reposted or moved (hail a mod) to the Work in Progress Addons section.

It would stand a much better chance of attracting the type of help you require.


Ahh thank you for pointing that out! I'm quite new to this forum so wasn't sure where to post this question. So...Any mod wanna move this? :)
B
4
Posts: 12
Reputation: 224


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 59 guests