Multi renderer for game sprites


#1

Hi guys,

I’m writing a simple RPG. Is it okay to use a separate renderer for the sprite?


#2

I guess what you really want is some kind of layer system, isn’t it?
If so, you don’t need and probably shouldn’t create multiple renderers for that.

You could just create another surface with createRGBSurface and then draw all your sprites to it with blitSurface before uploading and copying it to the main render target with renderCopy or renderCopyEx.

Or you could collect your render calls to sort them before actually dispatching them. In a topdown game you may want sort simply based on the Y-axis or you may want to introduce something like the z-index value similar to what you have in CSS.