Canvas Inheriting Transformations? NO ES BUENO
Posted: Sat Apr 26, 2014 5:01 pm
Hi all,
I'm not sure if this is a bug. Or if anyone has a work around. But it seems that Canvas inherits transformations. What I mean is if the graphics within the are transformed; so is the canvas. So, creating a camera is a pain.
Here is an example draw function:
I have also attached an example .love file. The code should be pretty forward.
I'm not sure if this is a bug. Or if anyone has a work around. But it seems that Canvas inherits transformations. What I mean is if the graphics within the are transformed; so is the canvas. So, creating a camera is a pain.
Here is an example draw function:
Code: Select all
love.graphics.setCanvas(Canvas)
Canvas:clear()
love.graphics.setColor(255, 0, 0)
--This is a background rect so you can see were the canvas is being drawn
love.graphics.rectangle("fill", 0, 0, 1000, 1000)
--Reset color for drawing the "Player" square
love.graphics.setColor(255, 255, 255, 255)
love.graphics.rectangle("fill", Player["x"], Player["y"], 100, 100)
--A transformation moving the environment around
Camera.moveCenter(-Player["x"], -Player["y"])
love.graphics.setCanvas()
--Draw the canvas at 0,0
love.graphics.draw(Canvas, 0, 0)