Difference between revisions of "love.graphics.printf"

m
Line 22: Line 22:
 
</source>
 
</source>
 
== Notes ==
 
== Notes ==
Note that the third argument in love.graphics.printf affects the position of your text for 'center' and 'right' alignment.
+
Note that the limit argument in love.graphics.printf affects the position of your text for 'center' and 'right' alignment.
 
<source lang="lua">
 
<source lang="lua">
 
love.graphics.printf("This text is aligned center",100, 100, 200,"center") -- center your text around x = 200/2 + 100 = 200
 
love.graphics.printf("This text is aligned center",100, 100, 200,"center") -- center your text around x = 200/2 + 100 = 200

Revision as of 13:27, 2 August 2012

Draws formatted text, with word wrap and alignment.

See additional notes in love.graphics.print.

Function

Synopsis

love.graphics.printf( text, x, y, limit, align )

Arguments

string text
A text string.
number x
The position on the x-axis.
number y
The position on the y-axis.
number limit
Wrap the line after this many horizontal pixels.
AlignMode align ("left")
The alignment.

Returns

Nothing.

Examples

Draw text to the screen with right alignment and a horizontal limit of 125.

love.graphics.printf("This text is aligned right, and wraps when it gets too big.", 25, 25, 125, "right")

Notes

Note that the limit argument in love.graphics.printf affects the position of your text for 'center' and 'right' alignment.

love.graphics.printf("This text is aligned center",100, 100, 200,"center") -- center your text around x = 200/2 + 100 = 200
love.graphics.printf("This text is aligned right",100, 100, 200,"right") -- align right to x = 100 + 200 = 300

See Also


Other Languages