Documentation > GUI > Text

Parent du composant : Panel
Version: 2.0.4

Constructor Text.new(Content, X, Y, Width, Height, Color, FontName, FontSize, HAlign, VAlign, Z, WaitTime, DisplayTime, NbLoop)

This function creates a new Text object.

Content

Content of the text.

X

Position on the X axis of the text.

Y

Position on the Y axis of the text.

Width

Width of the space occupied by the text.

Height

Height of the space occupied by the text.

TextColor

Color of the text.

FontName

Name and path of the font file.

FontSize

Size of the text.

HAlign

Horizontal alignment.

VAlign

Vertical alignment.

Z

Z-Order of the text.

WaitTime

Duration before displaying the text.

DisplayTime

Duration for showing the text.

NbLoop

Number of time the text will be shown (all durations will also be repeat).

Return

Return an instance of Text object.

Text:draw()

This function draw the text with its color and font. The text is aligned horizontally and vertically inside the width and height defined during its creation (by default, upper left).

Text:getContent()

This functions returns the content of the text.

Return

Returns the content of the text.

Text:setContent(Content)

This function sets the text to display. If the text received is nil or an empty string, the timers are reseted.

Content

Text to display.

Text:getFont()

This function returns the font defined for the text

Return

Font of the text

Text:setFont(FontName, FontSize)

This function sets the font and size of the text. If the FontName is nil, no font is set. The width and height of the text are updated.

FontName

Path and name of the font to use to display the text. Should not be nil.

FontSize

Font size of the text.

Text:setFontSize(Size)

This function changes the font size of the text. If no font has been set, the current text size will remain. The width and height of the text are updated.

Size

New font size.

Text:getTextColor()

This function returns the color of the text.

Return

Color of the text

Text:setTextColor(Color)

This function change the color of the text with the given color.

Color

New color of the text.

Text:getTextHeight()

This function returns the height of the text.

Return

Height of the text

Text:getTextWidth()

This function returns the width of the text.

Return

Width of the text.

Text:getTextDimensions()

This function returns the width and height of the text

Return

Width and height of the text

Text:getAlignments()

This function returns the alignments of the text.

Return

Horizontal and vertical alignments of the text.

Text:setAlignments(HAlign, VAlign)

This function defines the horizontal and vertical alignments of the text.

HAlign

Horizontal alignment of the text. Can be "left", "center" or "right" (default : left).

VAlign

Vertical alignment of the text. Can be "up", "center" or "bottom (default : up)

Text:resetTimers()

This function sets the timers to -1 for the display time, 0 for the waiting time ans -1 for the number of loops. Those values display the text without any effect.

Text:setTimers(WaitTime, DisplayTime, NbLoop)

This function sets the timers used for displaying the text.

WaitTime

Duration before displaying the text.

DisplayTime

Duration for showing the text.

NbLoop

Number of time the text will be shown (all durations will also be repeat).

Text:update(dt)

This funtion launches all updates needed for the current text.

dt

Delta time.

Text:toString(NoTitle)

This function display all variables containing in the current Text instance (tables and functions are excluded).

NoTitle

Indicates if the title must be displayed (false) or not (true).