# nodesnim/nodescontrol/label

Dark Mode

Search:
Group by:

It provides primitive text rendering.

# Imports

../thirdparty/opengl, ../thirdparty/opengl/glut, ../core/vector2, ../core/rect2, ../core/anchor, ../core/input, ../core/enums, ../core/color, ../nodes/node, control

# Types

    LabelObj = object of ControlRef
      font*: pointer               ## Glut font data.
      spacing*: float              ## Font spacing.
      size*: float                 ## Font size.
      text*: string                ## Label text.
      color*: ColorRef             ## Text color.
      text_align*: AnchorRef       ## Text align.

    LabelRef = ref LabelObj

# Procs

    proc Label(name: string = "Label"): LabelRef {...}{.raises: [], tags: [].}

  Creates a new Label.

  Arguments:

  - `name` is a node name.

  Examples:

      var text = Label("Label")

# Methods

    method draw(self: LabelRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
                                           tags: [RootEffect].}

  This uses in the `window.nim`.

    method duplicate(self: LabelRef): LabelRef {...}{.base, raises: [], tags: [].}

  Duplicates Label object and create a new Label.

    method setTextAlign(self: LabelRef; align: AnchorRef) {...}{.base, raises: [], tags: [].}

  Changes text alignment.

    method setTextAlign(self: LabelRef; x1, y1, x2, y2: float) {...}{.base, raises: [], tags: [].}

  Changes text alignment.

    method setText(self: LabelRef; value: string) {...}{.base, raises: [], tags: [].}

  Changes Label text.