Difference between revisions of "love.graphics.print"
(I guess this part about ColorMode won't be too relevant with 0.9.0.) |
m (Clarified note about null characters to say it's only relevant in 0.8.0 and below) |
||
Line 38: | Line 38: | ||
</source> | </source> | ||
== Notes == | == Notes == | ||
− | 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. | + | 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. |
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] |
Revision as of 07:00, 22 August 2013
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.
Contents
Function
Synopsis
love.graphics.print( text, x, y, r, sx, sy, ox, oy, kx, ky )
Arguments
string text
- The text to draw.
number x
- The position to draw the object (x-axis).
number y
- The position to draw the object (y-axis).
number r (0)
- Orientation (radians).
number sx (1)
- Scale factor (x-axis).
number sy (sx)
- Scale factor (y-axis).
number ox (0)
- Origin offset (x-axis).
number oy (0)
- Origin offset (y-axis).
Returns
Nothing.
Examples
A lame example
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
Notes
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.
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