A collection of positioned sprites ready to be rendered to the screen.
Each time Abstract_game::draw(Sprite_set&) is called by the game engine, it is given an empty Sprite_set, and it must add every sprites::Sprite that should appear on the screen to that Sprite_set. Each Sprite is added with an x–y geometry::Position and a z coordinate that determines stacking order. Each sprite may have a geometry::Transform applied as well.
Definition at line 379 of file ge211_sprites.h.
Public Member Functions | |
Sprite_set & | add_sprite (Sprite const &, Position, int z=0) |
Adds the given sprite at the given x–y geometry::Position and optional z coordinate, which defaults to 0. More... | |
Sprite_set & | add_sprite (Sprite const &, Position, int z, Transform const &) |
Adds the given sprite as the given geometry::Position and z coordinate, to be rendered with the given geometry::Transform. More... | |
Sprite_set & add_sprite | ( | Sprite const & | sprite, |
Position | xy, | ||
int | z = 0 |
||
) |
Adds the given sprite at the given x–y geometry::Position and optional z coordinate, which defaults to 0.
Sprites with higher z
values will be rendered on top of those with lower z
values. Two sprites with the same z
value that interfere will be stacked in an arbitrary order, so if you care about the layering of your sprites, provide different z
values.
Note that the Sprite_set does not copy the sprite it is given, but just stores a reference to it. Thus, the Sprite must live somewhere else, and continue to live until it is rendered.
Definition at line 24 of file ge211_sprites.cpp.
Sprite_set & add_sprite | ( | Sprite const & | sprite, |
Position | xy, | ||
int | z, | ||
Transform const & | t | ||
) |
Adds the given sprite as the given geometry::Position and z coordinate, to be rendered with the given geometry::Transform.
The transform allows scaling, flipping, and rotating the Sprite when rendered.
Definition at line 17 of file ge211_sprites.cpp.