Class Text

java.lang.Object
nl.colorize.multimedialib.stage.Text
All Implemented Interfaces:
Updatable, Graphic2D

public class Text extends Object implements Graphic2D
Draws text to the screen using the specified TrueType font. Multiline text is supported, and any newline characters in the text will be preserved when the text is rendered. By default, the text will occupy whatever horizontal space it needs, but word-wrapping can optionally be enabled by specifying an explicit line width.
  • Constructor Details

  • Method Details

    • setText

      public void setText(String text)
    • setText

      public void setText(List<String> text)
    • forLines

      public void forLines(BiConsumer<Integer,String> callback)
    • update

      public void update(float deltaTime)
      Description copied from interface: Updatable
      Updates this object for the current frame. deltaTime indicates the elapsed time since the last frame update, in seconds.
      Specified by:
      update in interface Updatable
    • getStageBounds

      public Rect getStageBounds()
      Description copied from interface: Graphic2D
      Returns the smallest possible rectangle that can contain this graphic, based on its current position and size. The returned coordinates are relative to the stage, not relative to the graphic's parent.
      Specified by:
      getStageBounds in interface Graphic2D
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLocation

      public DisplayListLocation getLocation()
      Description copied from interface: Graphic2D
      Returns the DisplayListLocation attached to this graphic, which is used by the renderer to determine how this graphic should be drawn.
      Specified by:
      getLocation in interface Graphic2D
    • getLines

      public List<String> getLines()
    • getFont

      public FontFace getFont()
    • getAlign

      public Align getAlign()
    • getLineWidth

      public int getLineWidth()
    • getLineHeight

      public float getLineHeight()
    • setLines

      public void setLines(List<String> lines)
    • setFont

      public void setFont(FontFace font)
    • setAlign

      public void setAlign(Align align)
    • setLineWidth

      public void setLineWidth(int lineWidth)
    • setLineHeight

      public void setLineHeight(float lineHeight)