Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
A sprite batch. More...
#include <gf/SpriteBatch.h>
Public Member Functions | |
SpriteBatch (RenderTarget &target) | |
Constructor. More... | |
void | begin () |
Begin the batch. More... | |
void | draw (Sprite &sprite, const RenderStates &states=RenderStates()) |
Add a sprite to the batch. More... | |
void | end () |
End the batch. More... | |
A sprite batch.
A sprite batch is responsible for minimizing the number of draw calls by concatenating the different calls for sprites.
Before using a sprite batch, you have to call begin()
, then call draw()
for each sprite you want to draw, and finally call end()
.
gf::SpriteBatch::SpriteBatch | ( | RenderTarget & | target | ) |
Constructor.
target | A render target where the sprites will be drawn |
void gf::SpriteBatch::begin | ( | ) |
Begin the batch.
void gf::SpriteBatch::draw | ( | Sprite & | sprite, |
const RenderStates & | states = RenderStates() |
||
) |
void gf::SpriteBatch::end | ( | ) |
End the batch.