Holds the sprite atlas and UVs for sprites in it. All spite atlases are padded, so no sprite atlas bleeding will occur.
More...
#include <SpriteAtlas.hpp>
Holds the sprite atlas and UVs for sprites in it. All spite atlases are padded, so no sprite atlas bleeding will occur.
- Note
- If SpriteAtlas fails to creat from the specified image, it will be created with the placeholder texture.
Definition at line 12 of file SpriteAtlas.hpp.
◆ Create()
| std::shared_ptr< SpriteAtlas > Cori::Graphics::SpriteAtlas::Create |
( |
std::string | name, |
|
|
const std::shared_ptr< Image > & | image, |
|
|
const glm::u16vec2 | spriteResolution ) |
|
staticnodiscard |
Creates a SpriteAtlas.
- Parameters
-
| name | Name to be assigned to the SpriteAtlas. |
| image | Image that will be used to create the SpriteAtlas. |
| spriteResolution | Resolution of one sprite in an atlas. |
- Note
- Total image size should be divisible by spriteResolution without a remainder.
- Returns
- Spared pointer to the created SpriteAtlas.
Definition at line 63 of file SpriteAtlas.cpp.
◆ GetName()
| std::string_view Cori::Graphics::SpriteAtlas::GetName |
( |
| ) |
const |
|
nodiscard |
◆ GetSpriteUVsAtIndex()
| const UVs & Cori::Graphics::SpriteAtlas::GetSpriteUVsAtIndex |
( |
uint32_t | index | ) |
const |
|
nodiscard |
Request the UVs for the spite at specific index.
- Parameters
-
| index | Sprite index to request. |
- Returns
- UVs for the requested sprite, or UVs for sprite at index 0 if no sprite with the specified index exist in the SpriteAtlas.
Definition at line 41 of file SpriteAtlas.cpp.
◆ GetSpriteUVsAtPosition()
| const UVs & Cori::Graphics::SpriteAtlas::GetSpriteUVsAtPosition |
( |
glm::u16vec2 | pos | ) |
const |
|
nodiscard |
Request the UVs for the spite at specific position.
- Parameters
-
| pos | Sprite position to request. |
- Returns
- UVs for the requested sprite, or UVs for sprite at position (0, 0) if no sprite with the specified position in the SpriteAtlas.
Definition at line 46 of file SpriteAtlas.cpp.
◆ GetSuccessStatus()
| bool Cori::Graphics::SpriteAtlas::GetSuccessStatus |
( |
| ) |
const |
|
nodiscard |
Checks if the SpriteAtlas was created successfully.
- Returns
- True if successful, false otherwise.
Definition at line 51 of file SpriteAtlas.cpp.
◆ GetTexture()
| std::shared_ptr< Texture2D > Cori::Graphics::SpriteAtlas::GetTexture |
( |
| ) |
const |
|
nodiscard |
The documentation for this class was generated from the following files: