![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <AnimationAtlas.hpp>
Public Member Functions | |
AnimationAtlas (const std::string &name) | |
Constructor. More... | |
bool | load (const std::string &path, const glm::uvec2 &frames) |
Load animation atlas from texture. More... | |
bool | load (const std::string &path, const glm::uvec2 &frames, const glm::uvec2 &rectMin, const glm::uvec2 &rectMax) |
Load animation atlas from part of texture. More... | |
const glm::vec2 & | getFrameSize () const |
Get size of a single frame. More... | |
![]() | |
TextureAtlas (const std::string &name) | |
Constructor. More... | |
~TextureAtlas () override | |
Destructor. More... | |
bool | load (const glm::uvec2 &atlasSize) |
Load an empty atlas. More... | |
template<typename... Args> | |
bool | load (const glm::uvec2 &atlasSize, const Args &...args) |
Load this atlas. More... | |
bool | load (const std::string &path, const LoadMode mode) |
Load from JSON file. More... | |
void | destroy () |
Destroy this atlas. More... | |
unsigned int | addTexture (const Image &image) |
Add texture from image to the atlas. More... | |
unsigned int | addTexture (const Texture2D &texture) |
Add texture to the atlas. More... | |
unsigned int | addTexture (const std::string &texturePath) |
Add texture from file to atlas. More... | |
unsigned int | defineTexture (const glm::vec2 &start, const glm::vec2 &end) |
Define a texture. More... | |
std::pair< glm::vec2, glm::vec2 > | getCoordinates (const unsigned int index) const |
Get texture location inside atlas. More... | |
unsigned int | getTextureAmount () const |
Get amount of textures inside atlas. More... | |
const Texture2D & | getTexture () const |
Get the texture of atlas. More... | |
![]() | |
Resource (const std::string &name) | |
Constructor. More... | |
virtual | ~Resource ()=0 |
Virtual destructor. More... | |
const std::string & | getName () const |
Get the name of this resource. More... | |
void | setPersistence (const unsigned short level) |
Set the persistence level. More... | |
unsigned short | getPersistence () const |
Get the persistence level. More... | |
![]() | |
WeakReference< Resource > | getReference () const |
Get a weak reference to the bound object. More... | |
![]() | |
SerializeInfo () | |
void | setSerializePackage (const uint16 package) |
uint16 | getSerializePackage () const |
void | setShouldSerialize (const bool set) |
bool | shouldSerialize () const |
void | setLightSerializeable (const bool set) |
bool | isLightSerializeable () const |
Additional Inherited Members | |
![]() | |
enum | LoadMode { LoadMode::Separate, LoadMode::Sheet, LoadMode::TextureOnly } |
Load mode. More... | |
![]() | |
Resource (const Resource &other, const std::string &newName) | |
Copy constructor. More... | |
![]() | |
SafeReferenceable (Resource *ref) | |
Constructor. More... | |
SafeReferenceable (SafeReferenceable< Resource > &&other) | |
Move constructor. More... | |
SafeReferenceable & | operator= (SafeReferenceable< Resource > &&other) |
Move assignment operator. More... | |
~SafeReferenceable () | |
Protected destructor. More... | |
Definition at line 35 of file AnimationAtlas.hpp.
jop::AnimationAtlas::AnimationAtlas | ( | const std::string & | name | ) |
Constructor.
name | Name for the resource |
const glm::vec2& jop::AnimationAtlas::getFrameSize | ( | ) | const |
Get size of a single frame.
bool jop::AnimationAtlas::load | ( | const std::string & | path, |
const glm::uvec2 & | frames | ||
) |
Load animation atlas from texture.
Creates an animation atlas from texture. Uses texture atlas to load the texture and automatically calculates the coordinates for each frame.
path | Path to the file which contains texture for animation atlas |
frames | How many frames are there in the texture (X, Y) |
bool jop::AnimationAtlas::load | ( | const std::string & | path, |
const glm::uvec2 & | frames, | ||
const glm::uvec2 & | rectMin, | ||
const glm::uvec2 & | rectMax | ||
) |
Load animation atlas from part of texture.
Creates an animation atlas from part of texture. Uses texture atlas to load the texture and automatically calculates the coordinates for each frame.
path | Path to the file which contains texture for animation atlas |
frames | How many frames are there in the texture (X, Y) |
rectMin | Minimum coordinates for the rectangle bounding the frames |
rectMax | Maximum coordinates for the rectangle bounding the frames |