9 #include <unordered_map> 12 #include <SFML/Graphics/Texture.hpp> 13 #include <SFML/System/Vector2.hpp> 15 #include <NasNas/core/graphics/Anim.hpp> 33 SpriteSheet(
const sf::Texture& texture,
const std::vector<Anim*>& anims);
40 void setTexture(
const sf::Texture& texture);
42 auto getTexture()
const ->
const sf::Texture*;
44 void setGrid(
const sf::Vector2i& cell_size,
int columns_nb,
int margin=0,
int spacing=0);
46 void addAnim(
Anim* new_anim);
48 void addAnim(
const std::string& anim_name,
unsigned int first_frame,
unsigned int nb_of_frames,
int duration,
const sf::Vector2i& origin={0,0});
49 void addAnim(
const std::string& anim_name,
unsigned int first_frame,
unsigned int nb_of_frames,
int duration,
const std::vector<sf::Vector2i>& origins);
50 void addAnim(
const std::string& anim_name,
unsigned int first_frame,
unsigned int nb_of_frames,
const std::vector<int>& durations,
const sf::Vector2i& origin={0,0});
51 void addAnim(
const std::string& anim_name,
unsigned int first_frame,
unsigned int nb_of_frames,
const std::vector<int>& durations,
const std::vector<sf::Vector2i>& origins);
53 void addAnim(
const std::string& anim_name,
const std::vector<unsigned int>& frames,
int duration,
const sf::Vector2i& origin={0,0});
54 void addAnim(
const std::string& anim_name,
const std::vector<unsigned int>& frames,
int duration,
const std::vector<sf::Vector2i>& origins);
55 void addAnim(
const std::string& anim_name,
const std::vector<unsigned int>& frames,
const std::vector<int>& durations,
const sf::Vector2i& origin={0,0});
56 void addAnim(
const std::string& anim_name,
const std::vector<unsigned int>& frames,
const std::vector<int>& durations,
const std::vector<sf::Vector2i>& origins);
62 auto getAnimsMap() ->
const std::unordered_map<std::string, Anim*>&;
69 auto getAnim(
const std::string& anim_name) ->
const Anim&;
72 const sf::Texture* m_texture =
nullptr;
73 std::unordered_map<std::string, Anim*> m_anims_map;
74 sf::Vector2i m_cell_size;
79 auto getFrameTexCoords(
unsigned int frame_index)
const -> sf::Vector2i;
auto getAnim(const std::string &anim_name) -> const Anim &
Get an Anim by its name.
auto getAnimsMap() -> const std::unordered_map< std::string, Anim *> &
Get a map containing all the Anim objects.
~SpriteSheet()
Delete all the Anim objects of this Spritesheet.