![]()  | 
  
    Gamedev Framework (gf)
    0.8.0
    
   A C++14 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 | draw (const Texture &texture, Vector2f position, const RenderStates &states=RenderStates()) | 
| Add a raw texture to the batch.  More... | |
| void | draw (const Texture &texture, const RectF &textureRect, Vector2f position, const RenderStates &states=RenderStates()) | 
| Add a portion of a raw texture 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::draw | ( | const Texture & | texture, | 
| Vector2f | position, | ||
| const RenderStates & | states = RenderStates()  | 
        ||
| ) | 
| void gf::SpriteBatch::draw | ( | const Texture & | texture, | 
| const RectF & | textureRect, | ||
| Vector2f | position, | ||
| const RenderStates & | states = RenderStates()  | 
        ||
| ) | 
Add a portion of a raw texture to the batch.
You must call begin() before calling this function, and end() once you have finished to draw the sprites.
| texture | The texture to draw | 
| textureRect | The sub-rectangle of the texture to draw | 
| position | The position of the texture | 
| states | The render states | 
| void gf::SpriteBatch::end | ( | ) | 
End the batch.
 1.8.13