Difference between revisions of "love.graphics.pop"

m
m
Line 1: Line 1:
 
Pops the current coordinate transformation from the transformation stack.
 
Pops the current coordinate transformation from the transformation stack.
  
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. For an example, see the description of [[love.graphics.push]].
+
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 ==

Revision as of 03:27, 29 August 2014

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.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


Other Languages