Canvas Inheriting Transformations? NO ES BUENO

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
NateAGeek
Prole
Posts: 2
Joined: Thu Apr 17, 2014 1:15 am

Canvas Inheriting Transformations? NO ES BUENO

Post by NateAGeek »

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:

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)
I have also attached an example .love file. The code should be pretty forward.
Attachments
LoveTest.love
Test the Canvas Props With Transfomations
(732 Bytes) Downloaded 65 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Canvas Inheriting Transformations? NO ES BUENO

Post by bartbes »

You can push() and pop(), or even reset the transformations.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests