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

0 favourites
  • 6 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • 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:

    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);[/code:1y6cwgtt]
    Wanted output:
    [code:1y6cwgtt]Hello
    World[/code:1y6cwgtt]
    Received output:
    [code:1y6cwgtt]Hello [?] World[/code:1y6cwgtt]
    
    Thank you!
  • Whyser

    Try newline

    You can find it in "System Expressions"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • Whyser

    Oh, wow, cool man Good luck.

    May I know what is the plug-in are you working on?

  • 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.

  • 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.

    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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)