TextNode

public class TextNode: Node, Renderable

A TextNode creates a string sprite essentially.

This still needs to be updated for modifying the text properties such as alignment. As well as support for glowing/outlined/better anti-aliased stuff, probably.

Note

It also currently does not support being updated even if the text property is. I’m not sure if that will ever change or if I’ll make the text property private at some point.

Warning

This will be incredibly slow in debug mode. I’m still trying to figure out a work around. Generally, creating the FontAtlas using Fonts in release mode will speed up the process significantly. After which switching back to debug will be ok as it’ll be cached.

Seealso

FontAtlas and Fonts classes.

  • Undocumented

    Declaration

    Swift

    public class TextNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class TextNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class TextNode: Node, Renderable
  • Undocumented

    Declaration

    Swift

    public class TextNode: Node, Renderable
  • Create a new text label node with a given font.

    Warning

    If the font does not exist yet this will take forever in debug mode and a bit of time with more compiler optimizations turned on.

    Declaration

    Swift

    public init(text: String, font: UIFont, color: Color)

    Parameters

    text

    The string to be displayed.

    font

    The font to render the string as.

    color

    The color of the node.

    Return Value

    A new instance of TextNode.