Difference between revisions of "Text:add"
m |
m (Add note about integer positions) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{newin|[[0.10.0]]|100|type=function}} | {{newin|[[0.10.0]]|100|type=function}} | ||
− | Adds additional text to the Text object at the specified position. | + | Adds additional colored text to the Text object at the specified position. |
+ | {{notice|Text may appear blurry if it's rendered at non-integer pixel locations.}} | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
Line 9: | Line 10: | ||
=== 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 | + | {{param|number|x (0)|The position of the new text on the x-axis.}} |
− | {{param|number|y|The position of the new text | + | {{param|number|y (0)|The position of the new text on the y-axis.}} |
− | {{param|number|angle (0)| | + | {{param|number|angle (0)|The orientation of the new text in radians.}} |
− | {{param|number|sx (1)|Scale factor | + | {{param|number|sx (1)|Scale factor on the x-axis.}} |
− | {{param|number|sy (sx)|Scale factor | + | {{param|number|sy (sx)|Scale factor on the y-axis.}} |
− | {{param|number|ox (0)|Origin offset | + | {{param|number|ox (0)|Origin offset on the x-axis.}} |
− | {{param|number|oy (0)|Origin offset | + | {{param|number|oy (0)|Origin offset on the y-axis.}} |
− | {{param|number|kx (0)|Shearing / skew factor | + | {{param|number|kx (0)|Shearing / skew factor on the x-axis.}} |
− | {{param|number|ky (0)|Shearing / skew factor | + | {{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]].}} | ||
+ | |||
+ | == Function == | ||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | index = Text:add( coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky ) | ||
+ | </source> | ||
+ | === Arguments === | ||
+ | {{param|table|coloredtext|A table containing colors and strings to add to the object, in the form of <code>{color1, string1, color2, string2, ...}</code>.}} | ||
+ | {{subparam|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 <code>{red, green, blue, alpha}</code>.}} | ||
+ | {{subparam|string|string1|A string of text which has a color specified by the previous color.}} | ||
+ | {{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|tables and strings|...|Additional colors and strings.}} | ||
+ | {{param|number|x (0)|The position of the new text on the x-axis.}} | ||
+ | {{param|number|y (0)|The position of the new text on the y-axis.}} | ||
+ | {{param|number|angle (0)|The orientation of the new text in radians.}} | ||
+ | {{param|number|sx (1)|Scale factor on the x-axis.}} | ||
+ | {{param|number|sy (sx)|Scale factor on the y-axis.}} | ||
+ | {{param|number|ox (0)|Origin offset on the x-axis.}} | ||
+ | {{param|number|oy (0)|Origin offset on the y-axis.}} | ||
+ | {{param|number|kx (0)|Shearing / skew factor on the x-axis.}} | ||
+ | {{param|number|ky (0)|Shearing / skew factor on the y-axis.}} | ||
+ | === Returns === | ||
+ | {{param|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 == | == See Also == | ||
Line 28: | Line 55: | ||
* [[Text:clear]] | * [[Text:clear]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
− | {{#set:Description=Adds additional text to the Text object at the specified position.}} | + | {{#set:Description=Adds additional colored text to the Text object at the specified position.}} |
== Other Languages == | == Other Languages == | ||
{{i18n|Text:add}} | {{i18n|Text:add}} |
Latest revision as of 00:26, 28 August 2017
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.
Text may appear blurry if it's rendered at non-integer pixel locations. |
Contents
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 (0)
- The position of the new text on the x-axis.
number y (0)
- The position of the new text on the y-axis.
number angle (0)
- The orientation of the new text in 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.
tables and strings ...
- Additional colors and strings.
number x (0)
- The position of the new text on the x-axis.
number y (0)
- The position of the new text on the y-axis.
number angle (0)
- The orientation of the new text in 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
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info