Difference between revisions of "love.graphics.pop"
(added pop) |
(→Examples) |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
Pops the current coordinate transformation from the transformation stack. | Pops the current coordinate transformation from the transformation stack. | ||
− | This | + | This function is always used to reverse a previous [[love.graphics.push|push]] operation. It returns the current transformation state to what it was before the last preceding push. |
== Function == | == Function == | ||
Line 12: | Line 12: | ||
=== Returns === | === Returns === | ||
Nothing. | Nothing. | ||
+ | |||
+ | == Examples == | ||
+ | Draw two lines of text, one scaled and one normal, using [[love.graphics.scale]]. We use [[love.graphics.pop]] to return to normal render scale, after having used [[love.graphics.push]]. | ||
+ | <source lang="lua"> | ||
+ | function love.draw() | ||
+ | love.graphics.push() -- stores the coordinate system | ||
+ | -- love.graphics.push("all") -- stores all: transform, colors etc. | ||
+ | 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.pop() -- return to stored coordinated | ||
+ | love.graphics.print("Normal text", 50, 50) | ||
+ | end | ||
+ | </source> | ||
+ | |||
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] | ||
Line 18: | Line 32: | ||
* [[love.graphics.rotate]] | * [[love.graphics.rotate]] | ||
* [[love.graphics.scale]] | * [[love.graphics.scale]] | ||
+ | * [[love.graphics.shear]] | ||
+ | * [[love.graphics.origin]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
{{#set:Description=Pops the current coordinate transformation from the transformation stack.}} | {{#set:Description=Pops the current coordinate transformation from the transformation stack.}} | ||
+ | {{#set:Since=000}} | ||
+ | {{#set:Sub-Category=Coordinate System}} | ||
+ | == Other Languages == | ||
+ | {{i18n|love.graphics.pop}} |
Latest revision as of 08:05, 13 March 2024
Pops the current coordinate transformation from the transformation stack.
This function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push.
Function
Synopsis
love.graphics.pop()
Arguments
None
Returns
Nothing.
Examples
Draw two lines of text, one scaled and one normal, using love.graphics.scale. We use love.graphics.pop to return to normal render scale, after having used love.graphics.push.
function love.draw()
love.graphics.push() -- stores the coordinate system
-- love.graphics.push("all") -- stores all: transform, colors etc.
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.pop() -- return to stored coordinated
love.graphics.print("Normal text", 50, 50)
end
See Also
- love.graphics
- love.graphics.push
- love.graphics.translate
- love.graphics.rotate
- love.graphics.scale
- love.graphics.shear
- love.graphics.origin
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