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

0 favourites
  • 3 posts
From the Asset Store
Horror Halloween Pixel Art Sprite Font Space Data included
  • (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:

    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:2v2sf4ih]
    Wanted output:
    [code:2v2sf4ih]Hello
    World[/code:2v2sf4ih]
    Received output:
    [code:2v2sf4ih]Hello [?] World[/code:2v2sf4ih]
    
    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.
  • Try Construct 3

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

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

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

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