Difference between revisions of "Text:add"

m
m
Line 9: Line 9:
 
=== Arguments ===
 
=== Arguments ===
 
{{param|string|textstring|The text to add to the object.}}
 
{{param|string|textstring|The text to add to the object.}}
{{param|number|x|The position of the new text (x-axis).}}
+
{{param|number|x|The position of the new text on the x-axis.}}
{{param|number|y|The position of the new text (y-axis).}}
+
{{param|number|y|The position of the new text on the y-axis.}}
 
{{param|number|angle (0)|Orientation (radians).}}
 
{{param|number|angle (0)|Orientation (radians).}}
{{param|number|sx (1)|Scale factor (x-axis).}}
+
{{param|number|sx (1)|Scale factor on the x-axis.}}
{{param|number|sy (sx)|Scale factor (y-axis).}}
+
{{param|number|sy (sx)|Scale factor on the y-axis.}}
{{param|number|ox (0)|Origin offset (x-axis).}}
+
{{param|number|ox (0)|Origin offset on the x-axis.}}
{{param|number|oy (0)|Origin offset (y-axis).}}
+
{{param|number|oy (0)|Origin offset on the y-axis.}}
{{param|number|kx (0)|Shearing / skew factor (x-axis).}}
+
{{param|number|kx (0)|Shearing / skew factor on the x-axis.}}
{{param|number|ky (0)|Shearing / skew factor (y-axis).}}
+
{{param|number|ky (0)|Shearing / skew factor on the y-axis.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|number|index|An index number that can be used with [[Text:getWidth]] or [[Text:getHeight]].}}
 
{{param|number|index|An index number that can be used with [[Text:getWidth]] or [[Text:getHeight]].}}
Line 32: Line 32:
 
{{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.}}
{{param|number|x|The position of the new text (x-axis).}}
+
{{param|number|x|The position of the new text on the x-axis.}}
{{param|number|y|The position of the new text (y-axis).}}
+
{{param|number|y|The position of the new text on the y-axis.}}
 
{{param|number|angle (0)|Orientation (radians).}}
 
{{param|number|angle (0)|Orientation (radians).}}
{{param|number|sx (1)|Scale factor (x-axis).}}
+
{{param|number|sx (1)|Scale factor on the x-axis.}}
{{param|number|sy (sx)|Scale factor (y-axis).}}
+
{{param|number|sy (sx)|Scale factor on the y-axis.}}
{{param|number|ox (0)|Origin offset (x-axis).}}
+
{{param|number|ox (0)|Origin offset on the x-axis.}}
{{param|number|oy (0)|Origin offset (y-axis).}}
+
{{param|number|oy (0)|Origin offset on the y-axis.}}
{{param|number|kx (0)|Shearing / skew factor (x-axis).}}
+
{{param|number|kx (0)|Shearing / skew factor on the x-axis.}}
{{param|number|ky (0)|Shearing / skew factor (y-axis).}}
+
{{param|number|ky (0)|Shearing / skew factor on the y-axis.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|number|index|An index number that can be used with [[Text:getWidth]] or [[Text:getHeight]].}}
 
{{param|number|index|An index number that can be used with [[Text:getWidth]] or [[Text:getHeight]].}}

Revision as of 15:10, 24 November 2015

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

Adds additional colored text to the Text object at the specified position.

Function

Synopsis

index = Text:add( textstring, x, y, angle, sx, sy, ox, oy, kx, ky )

Arguments

string textstring
The text to add to the object.
number x
The position of the new text on the x-axis.
number y
The position of the new text on the y-axis.
number angle (0)
Orientation (radians).
number sx (1)
Scale factor on the x-axis.
number sy (sx)
Scale factor on the y-axis.
number ox (0)
Origin offset on the x-axis.
number oy (0)
Origin offset on the y-axis.
number kx (0)
Shearing / skew factor on the x-axis.
number ky (0)
Shearing / skew factor on the y-axis.

Returns

number index
An index number that can be used with Text:getWidth or Text:getHeight.

Function

Synopsis

index = Text:add( coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky )

Arguments

table coloredtext
A table containing colors and strings to add to the object, 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.
number x
The position of the new text on the x-axis.
number y
The position of the new text on the y-axis.
number angle (0)
Orientation (radians).
number sx (1)
Scale factor on the x-axis.
number sy (sx)
Scale factor on the y-axis.
number ox (0)
Origin offset on the x-axis.
number oy (0)
Origin offset on the y-axis.
number kx (0)
Shearing / skew factor on the x-axis.
number ky (0)
Shearing / skew factor on the y-axis.

Returns

number index
An index number that can be used with Text:getWidth or Text:getHeight.

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