love.graphics.newTextBatch
Available since LÖVE 12.0 |
It has been renamed from Text. |
Creates a new drawable TextBatch object.
This function can be slow if it is called repeatedly, such as from love.update or love.draw. If you need to use a specific resource often, create it once and store it somewhere it can be reused! |
Contents
Function
Synopsis
text = love.graphics.newTextBatch( font, textstring )
Arguments
Font font
- The font to use for the text.
string textstring (nil)
- The initial string of text that the new TextBatch object will contain. May be nil.
Returns
TextBatch text
- The new drawable TextBatch object.
Function
Synopsis
text = love.graphics.newTextBatch( font, coloredtext )
Arguments
Font font
- The font to use for the text.
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.
Returns
TextBatch text
- The new drawable TextBatch object.
Example
local font = love.graphics.getFont()
--regular text
local plainText = love.graphics.newTextBatch(font, "Hello world")
--colored text
local coloredText = love.graphics.newTextBatch(font, {{1, 0, 0}, "Hello ", {0, 0, 1}, " world"})
Notes
The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text, when drawing the TextBatch 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