Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Member Functions | List of all members
jop::AnimationAtlas Class Reference

#include <AnimationAtlas.hpp>

Inheritance diagram for jop::AnimationAtlas:
jop::TextureAtlas jop::Resource jop::SafeReferenceable< Resource > jop::SerializeInfo

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...
 
- Public Member Functions inherited from jop::TextureAtlas
 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 Texture2DgetTexture () const
 Get the texture of atlas. More...
 
- Public Member Functions inherited from jop::Resource
 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...
 
- Public Member Functions inherited from jop::SafeReferenceable< Resource >
WeakReference< ResourcegetReference () const
 Get a weak reference to the bound object. More...
 
- Public Member Functions inherited from jop::SerializeInfo
 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

- Public Types inherited from jop::TextureAtlas
enum  LoadMode { LoadMode::Separate, LoadMode::Sheet, LoadMode::TextureOnly }
 Load mode. More...
 
- Protected Member Functions inherited from jop::Resource
 Resource (const Resource &other, const std::string &newName)
 Copy constructor. More...
 
- Protected Member Functions inherited from jop::SafeReferenceable< Resource >
 SafeReferenceable (Resource *ref)
 Constructor. More...
 
 SafeReferenceable (SafeReferenceable< Resource > &&other)
 Move constructor. More...
 
SafeReferenceableoperator= (SafeReferenceable< Resource > &&other)
 Move assignment operator. More...
 
 ~SafeReferenceable ()
 Protected destructor. More...
 

Detailed Description

Definition at line 35 of file AnimationAtlas.hpp.

Constructor & Destructor Documentation

jop::AnimationAtlas::AnimationAtlas ( const std::string &  name)

Constructor.

Parameters
nameName for the resource

Member Function Documentation

const glm::vec2& jop::AnimationAtlas::getFrameSize ( ) const

Get size of a single frame.

Returns
The 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.

Parameters
pathPath to the file which contains texture for animation atlas
framesHow many frames are there in the texture (X, Y)
Returns
True if successful
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.

Parameters
pathPath to the file which contains texture for animation atlas
framesHow many frames are there in the texture (X, Y)
rectMinMinimum coordinates for the rectangle bounding the frames
rectMaxMaximum coordinates for the rectangle bounding the frames
Returns
True if successful

The documentation for this class was generated from the following file: