That's the trouble with SpriteBatches, you can't remove stuff. As of 0.8, you can modify entries, but still can't remove them.OmarShehata wrote:There doesn't seem to be a way to remove individual items from a Batch, would I have to clear everything and add them all back if I wanted to remove 1?
So so far it seems Sprite Batches are really good for things that won't move or get changed often, that don't need to be updated every frame.
Also, is there any way I can use canvases to speed things up even more? I keep thinking I could draw the backgrounds and static tiles onto a canvas, so that I only draw it once, and only redraw that canvas when I change anything, but then I could do the same thing with a sprite batch and update the sprite batch when I need to.
I'm not sure whether canvases would be faster, but it would seem so, as it's like a single image. Besides, if you're drawing tiles, you can effectively delete and replace tiles by clearing a section of the canvas and drawing over the top of it, like this:
Code: Select all
love.graphics.setCanvas(canvas)
love.graphics.setScissor(x, y, tileWidth, tileHeight)
canvas:clear()
love.graphics.drawq(tiles, quad, x, y)
love.graphics.setScissor()
love.graphics.setCanvas()