Copies and pushes the current coordinate transformation to the transformation stack.

This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push.


Pushes the graphics state to the stack.

Synopsis stack )


Available since LÖVE 0.9.2
StackType stack ("transform")
The type of stack to push (e.g. just transformation state, or all state).




Modify and restore the coordinate system.

function love.draw() -- stores the default coordinate system -- move the camera position -- zoom the camera
	-- use the new coordinate system to draw the viewed scene -- return to the default coordinates
	-- draw the status display using the screen coordinates

Available since LÖVE 0.9.2
This example is not supported in earlier versions.

Modify state in a function, and restore it easily so other code isn't disturbed.

function DrawCoolThing()"all") -- save all state so any changes can be restored, 0, 1)"subtract")"fill", 400, 300, 80) -- restore the saved state

function love.draw(), 0.5, 0.5)"fill", 400, 300, 100)

    DrawCoolThing()"fill", 600, 200, 200, 200) -- still uses the color set at the top of love.draw

See Also

Other Languages