Views
love.graphics.origin
Available since LÖVE 0.9.0 |
This function is not supported in earlier versions. |
Resets the current coordinate transformation.
This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults.
Function
Synopsis
love.graphics.origin()
Arguments
None
Returns
Nothing.
Example
function love.draw()
love.graphics.push() -- stores the coordinate system
love.graphics.scale(0.5, 0.5) -- reduce everything by 50% in both X and Y coordinates
love.graphics.print("Scaled text", 50, 50) -- print half-sized text at 25x25
love.graphics.push()
love.graphics.origin() -- Rest the state to the defaults.
love.graphics.draw(image, 0, 0) -- Draw the image on screen as if nothing was scaled.
love.graphics.pop() -- return to our scaled coordinate state.
love.graphics.print("Scaled text", 100, 100) -- print half-sized text at 50x50
love.graphics.pop() -- return to the previous stored coordinated
love.graphics.print("Normal text", 50, 50)
end
love.graphics.push() -- stores the coordinate system
love.graphics.scale(0.5, 0.5) -- reduce everything by 50% in both X and Y coordinates
love.graphics.print("Scaled text", 50, 50) -- print half-sized text at 25x25
love.graphics.push()
love.graphics.origin() -- Rest the state to the defaults.
love.graphics.draw(image, 0, 0) -- Draw the image on screen as if nothing was scaled.
love.graphics.pop() -- return to our scaled coordinate state.
love.graphics.print("Scaled text", 100, 100) -- print half-sized text at 50x50
love.graphics.pop() -- return to the previous stored coordinated
love.graphics.print("Normal text", 50, 50)
end
See Also
- love.graphics
- love.graphics.pop
- love.graphics.push
- love.graphics.rotate
- love.graphics.scale
- love.graphics.shear
- love.graphics.translate
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