Difference between revisions of "Text:setf"

(Added colored text variant)
(The align mode isn't optional)
 
(One intermediate revision by one other user not shown)
Line 10: Line 10:
 
{{param|string|textstring|The new string of text to use.}}
 
{{param|string|textstring|The new string of text to use.}}
 
{{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}}
 
{{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}}
{{param|AlignMode|align ("left")|The alignment of the text.}}
+
{{param|AlignMode|align|The alignment of the text.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
Line 25: Line 25:
 
{{subparam|table|color2|A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of <code>{red, green, blue, alpha}</code>.}}
 
{{subparam|table|color2|A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of <code>{red, green, blue, alpha}</code>.}}
 
{{subparam|string|string2|A string of text which has a color specified by the previous color.}}
 
{{subparam|string|string2|A string of text which has a color specified by the previous color.}}
 +
{{subparam|tables and strings|...|Additional colors and strings.}}
 
{{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}}
 
{{param|number|wraplimit|The maximum width in pixels of the text before it gets automatically wrapped to a new line.}}
{{param|AlignMode|align ("left")|The alignment of the text.}}
+
{{param|AlignMode|align|The alignment of the text.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.

Latest revision as of 21:49, 23 October 2017

Available since LÖVE 0.10.0
This function is not supported in earlier versions.

Replaces the contents of the Text object with a new formatted string.

Function

Synopsis

Text:setf( textstring, wraplimit, alignmode )

Arguments

string textstring
The new string of text to use.
number wraplimit
The maximum width in pixels of the text before it gets automatically wrapped to a new line.
AlignMode align
The alignment of the text.

Returns

Nothing.

Function

Synopsis

Text:setf( coloredtext, wraplimit, alignmode )

Arguments

table coloredtext
A table containing colors and strings to use as the new text, in the form of {color1, string1, color2, string2, ...}.
table color1
A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.
string string1
A string of text which has a color specified by the previous color.
table color2
A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}.
string string2
A string of text which has a color specified by the previous color.
tables and strings ...
Additional colors and strings.
number wraplimit
The maximum width in pixels of the text before it gets automatically wrapped to a new line.
AlignMode align
The alignment of the text.

Returns

Nothing.

Notes

The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the Text object.

See Also

Other Languages