Difference between revisions of "love.graphics.translate (简体中文)"
(Fixed parent) |
|||
Line 1: | Line 1: | ||
Translates the coordinate system in two dimensions. | Translates the coordinate system in two dimensions. | ||
+ | 平移坐标系中的原点x和y的位置。 | ||
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. | 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. | ||
+ | 当使用本函数并传入dx和dy的值时,从本函数调用之后的绘图操作将会受到影响,致使绘图操作后最终的位置是dx+x,dy+y。(›´ω`‹ ) | ||
Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. | Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. | ||
+ | 缩放和平移不是交换操作,因此,按不同的顺序调用它们会改变结果。 | ||
This change lasts until [[love.draw]]() exits or else a [[love.graphics.pop]] reverts to a previous [[love.graphics.push]]. | This change lasts until [[love.draw]]() exits or else a [[love.graphics.pop]] reverts to a previous [[love.graphics.push]]. | ||
Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating. | Translating using whole numbers will prevent tearing/blurring of images and fonts draw after translating. | ||
+ | 使用整数作为参数可以防止平移后图像和字体的撕裂/模糊。 | ||
== Function == | == Function == |
Latest revision as of 13:27, 7 June 2018
Translates the coordinate system in two dimensions. 平移坐标系中的原点x和y的位置。
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. 当使用本函数并传入dx和dy的值时,从本函数调用之后的绘图操作将会受到影响,致使绘图操作后最终的位置是dx+x,dy+y。(›´ω`‹ )
Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. 缩放和平移不是交换操作,因此,按不同的顺序调用它们会改变结果。
This change lasts until love.draw() exits or else a love.graphics.pop reverts to a previous love.graphics.push.
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