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?
Drawing a tilemap on a canvas, problem with culling.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- OmarShehata
- Party member
- Posts: 259
- Joined: Tue May 29, 2012 6:46 pm
- Location: Egypt
- Contact:
Re: Drawing a tilemap on a canvas, problem with culling.
I'm not sure if I perfectly understand the set up you have, but you could translate back before you draw the canvas, that should work.
Or use love.graphics.push/pop to save a state and revert back to it. http://www.love2d.org/wiki/love.graphics.push
If you can upload a .love file we could offer more help!
Or use love.graphics.push/pop to save a state and revert back to it. http://www.love2d.org/wiki/love.graphics.push
If you can upload a .love file we could offer more help!
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Drawing a tilemap on a canvas, problem with culling.
You need to pop it back before drawing the canvas yes.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 9 guests