Drawing a tilemap on a canvas, problem with culling.
Posted: Sun Aug 10, 2014 8:36 am
I'm currently participating in the gbjam3, and so far it's going pretty good. To get the scaling smooth (with no gap between tiles or the like) I'm drawing everything to a canvas, then scaling and translating it by the cameras origin.
The problem is that I'm not sure how to get the culling to work, I know how to calculate the range of tiles to draw, but it seems love.graphics.translate(dx,dy) also translates the canvas, which means it futile to draw to it. I can't seem to move the canvas either so I'm not sure what to do :/
Anyone know how to keep the canvas inside of the view?
The problem is that I'm not sure how to get the culling to work, I know how to calculate the range of tiles to draw, but it seems love.graphics.translate(dx,dy) also translates the canvas, which means it futile to draw to it. I can't seem to move the canvas either so I'm not sure what to do :/
Anyone know how to keep the canvas inside of the view?