Draws text on screen. If no Font is set, one will be created and set (once) if needed.
As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don't script with this in mind, the text won't be in the right position, or possibly even on screen.
love.graphics.print and love.graphics.printf both suppport UTF-8 encoding. You'll also need a proper Font for special characters.
love.graphics.print( text, x, y, r, sx, sy, ox, oy, kx, ky )
string text
number x
number y
number r (0)
number sx (1)
number sy (sx)
number ox (0)
number oy (0)
number kx (0)
Available since 0.8.0
number ky (0)
Available since 0.8.0
Nothing.
Available since LÖVE 0.10.0
This variant is not supported in earlier versions.
love.graphics.print( coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky )
table coloredtext
{color1, string1, color2, string2, ...}
. table color1
{red, green, blue, alpha}
.string string1
table color2
{red, green, blue, alpha}
.string string2
tables and strings ...
number x
number y
number angle (0)
number sx (1)
number sy (sx)
number ox (0)
number oy (0)
number kx (0)
number ky (0)
Nothing.
The color set by love.graphics.setColor will be combined (multiplied) with the colors of the text.
function love.draw() love.graphics.setColor(0, 255, 0, 255) love.graphics.print("This is a pretty lame example.", 10, 200) love.graphics.setColor(255, 0, 0, 255) love.graphics.print("This lame example is twice as big.", 10, 250, 0, 2, 2) love.graphics.setColor(0, 0, 255, 255) love.graphics.print("This example is lamely vertical.", 300, 30, math.pi/2) end
In version 0.8.0 and older, love.graphics.print stops at the first '\0' (null) character. This can bite you if you are appending keystrokes to form your string, as some of those are multi-byte unicode characters which will likely contain null bytes.
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.graphics.print