Skip to content

Commit

Permalink
SpriteHandler.h:
Browse files Browse the repository at this point in the history
* Added function clone_sprite_array() in SpriteHandler.
  • Loading branch information
razterizer committed Oct 30, 2024
1 parent 9e37ad7 commit 10adee2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions SpriteHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,17 @@ class SpriteHandler
return nullptr;
}

template<int NS>
std::array<Sprite*, NS> clone_sprite_array(const std::string& sprite_base_name, const std::string& from_sprite_name)
{
std::array<Sprite*, NS> sprite_arr;

for (int sprite_idx = 0; sprite_idx < NS; ++sprite_idx)
sprite_arr[sprite_idx] = clone_sprite(sprite_base_name + std::to_string(sprite_idx), from_sprite_name);

return sprite_arr;
}

template<int NR, int NC>
void draw(ScreenHandler<NR, NC>& sh, int sim_frame) const
{
Expand Down

0 comments on commit 10adee2

Please sign in to comment.