Difference between revisions of "love.graphics.translate"
(Add an example) |
m |
||
Line 25: | Line 25: | ||
<source lang="lua"> | <source lang="lua"> | ||
function love.draw() | function love.draw() | ||
− | + | love.graphics.translate(10, 10) | |
− | + | love.graphics.print("Text", 5, 5) -- will effectively render at 15x15 | |
end | end | ||
</source> | </source> |
Revision as of 20:54, 26 September 2011
Translates the coordinate system in two dimensions.
When this function is called with two numbers, dx, and dy, all the following drawing operations take effect as if their x and y coordinates were x+dx and y+dy.
Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome.
This change lasts until love.draw() exits.
Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating.
Function
Synopsis
love.graphics.translate( dx, dy )
Arguments
Returns
Nothing.
Examples
Translate down and to the right by 10 pixels. Remember, the translation is reset at the end of each love.draw.
function love.draw()
love.graphics.translate(10, 10)
love.graphics.print("Text", 5, 5) -- will effectively render at 15x15
end
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