SpriteBatch with a z cord
Posted: Fri Nov 27, 2015 9:55 pm
Hello. I have made a fairly competent game so far, and I am looking into using spriteBatches for additional performance, however I am limited by the fact that I have a z map on my maps (ordered map of when to draw what which is dynamic).
So my question is:
How do I use sprite batches alongside a z map assuming that the z cord can change while in game?
Is there a way to manage the draw order between two sprite batches?
I have been pondering about this for a while now and there is a possible solution that I have figured:
Sample all of the images at load on single z cord and put them all on a image data and use it as a sprite batch.
However as you may guess this isn't an optimal solution as:
greatly extends the load time
consumes more RAM
prevents the change of z cord at run time.
draws all of the quads on the map, instead of drawing only what is visible
Is there any other better option for me and is it worth it, assuming that I am drawing the same quad of an image more than 10 times and am only drawing images that are on the screen?
So my question is:
How do I use sprite batches alongside a z map assuming that the z cord can change while in game?
Is there a way to manage the draw order between two sprite batches?
I have been pondering about this for a while now and there is a possible solution that I have figured:
Sample all of the images at load on single z cord and put them all on a image data and use it as a sprite batch.
However as you may guess this isn't an optimal solution as:
greatly extends the load time
consumes more RAM
prevents the change of z cord at run time.
draws all of the quads on the map, instead of drawing only what is visible
Is there any other better option for me and is it worth it, assuming that I am drawing the same quad of an image more than 10 times and am only drawing images that are on the screen?