A SpriteBatch is used to draw 2D rectangles that reference a texture (region). The class will batch the drawing commands and optimize them for processing by the GPU.
To draw something with a SpriteBatch one has to first call the {@link SpriteBatch#begin()} method which will setup appropriaterender states. When you are done with drawing you have to call {@link SpriteBatch#end()} which will actually draw the thingsyou specified.
All drawing commands of the SpriteBatch operate in screen coordinates. The screen coordinate system has an x-axis pointing to the right, an y-axis pointing upwards and the origin is in the lower left corner of the screen. You can also provide your own transformation and projection matrices if you so wish.
A SpriteBatch is managed. In case the OpenGL context is lost all OpenGL resources a SpriteBatch uses internally get invalidated. A context is lost when a user switches to another application or receives an incoming call on Android. A SpriteBatch will be automatically reloaded after the OpenGL context is restored.
A SpriteBatch is a pretty heavy object so you should only ever have one in your program.
A SpriteBatch works with OpenGL ES 1.x and 2.0. In the case of a 2.0 context it will use its own custom shader to draw all provided sprites. Specifying your own shader does not work (yet).
A SpriteBatch has to be disposed if it is no longer used.
@author mzechner