diff --git a/Source/Engine/Render2D/SpriteAtlas.cpp b/Source/Engine/Render2D/SpriteAtlas.cpp index b1a941ba1..217c950c4 100644 --- a/Source/Engine/Render2D/SpriteAtlas.cpp +++ b/Source/Engine/Render2D/SpriteAtlas.cpp @@ -40,6 +40,23 @@ SpriteAtlas::SpriteAtlas(const SpawnParams& params, const AssetInfo* info) { } +int32 SpriteAtlas::GetSpritesCount() const +{ + return Sprites.Count(); +} + +Sprite SpriteAtlas::GetSprite(int32 index) const +{ + CHECK_RETURN(index >= 0 && index < Sprites.Count(), Sprite()) + return Sprites.Get()[index]; +} + +void SpriteAtlas::SetSprite(int32 index, const Sprite& value) +{ + CHECK(index >= 0 && index < Sprites.Count()); + Sprites[index] = value; +} + SpriteHandle SpriteAtlas::FindSprite(const StringView& name) const { SpriteHandle result(const_cast(this), -1); diff --git a/Source/Engine/Render2D/SpriteAtlas.h b/Source/Engine/Render2D/SpriteAtlas.h index 9631b9ac9..6845de610 100644 --- a/Source/Engine/Render2D/SpriteAtlas.h +++ b/Source/Engine/Render2D/SpriteAtlas.h @@ -111,32 +111,21 @@ public: /// /// Gets the sprites count. /// - /// The sprites count. - API_PROPERTY() int32 GetSpritesCount() const - { - return Sprites.Count(); - } + API_PROPERTY() int32 GetSpritesCount() const; /// /// Gets the sprite data. /// /// The index. /// The sprite data. - API_FUNCTION() Sprite GetSprite(const int32 index) const - { - return Sprites[index]; - } + API_FUNCTION() Sprite GetSprite(int32 index) const; /// /// Sets the sprite data. /// /// The index. /// The sprite data. - /// The sprite handle. - API_FUNCTION() void SetSprite(const int32 index, API_PARAM(Ref) const Sprite& value) - { - Sprites[index] = value; - } + API_FUNCTION() void SetSprite(int32 index, API_PARAM(Ref) const Sprite& value); /// /// Finds the sprite by the name.