51 void add (
const std::string& entry, sf::IntRect&&
textureRect,
const uint32_t framesCount = 1);
56 void remove (
const std::string& entry);
72 std::optional <sf::IntRect>
textureRect (
const std::string& entry,
const uint32_t frame = 0)
const;
76 auto begin () {
return std::begin (mAtlas); }
77 auto end () {
return std::end (mAtlas); }
78 auto begin ()
const {
return std::cbegin (mAtlas); }
79 auto end ()
const {
return std::cend (mAtlas); }
81 uint32_t mTexturesCount = { 0 };
82 sf::Vector2u mTextureDimension = {};
83 std::unordered_map <std::string, Frames> mAtlas;
void remove(const std::string &entry)
Remove a texture from the atlas.
Definition TextureAtlas.cpp:38
auto begin()
Definition TextureAtlas.h:76
auto begin() const
Definition TextureAtlas.h:78
void clear()
Clear all textures from the atlas.
Definition TextureAtlas.cpp:44
uint32_t texturesCount() const
Get number of textures stored in the atlas.
Definition TextureAtlas.h:65
auto end()
Definition TextureAtlas.h:77
void add(const std::string &entry, sf::IntRect &&textureRect, const uint32_t framesCount=1)
Add a texture to the atlas.
Definition TextureAtlas.cpp:24
auto end() const
Definition TextureAtlas.h:79
bool loadFromFile(const std::string &filename)
Load texture atlas from file.
Definition TextureAtlas.cpp:16
std::optional< sf::IntRect > textureRect(const std::string &entry, const uint32_t frame=0) const
Get texture rect of an entry, if the entry exist.
Definition TextureAtlas.cpp:52