Polyphase Game Engine
Loading...
Searching...
No Matches
SpriteAnimation Class Reference

#include <SpriteAnimation.h>

Inheritance diagram for SpriteAnimation:
Asset Object

Public Member Functions

 DECLARE_ASSET (SpriteAnimation, Asset)
 
 SpriteAnimation ()
 
virtual ~SpriteAnimation ()
 
virtual void LoadStream (Stream &stream, Platform platform) override
 
virtual void SaveStream (Stream &stream, Platform platform) override
 
virtual void Create () override
 
virtual void Destroy () override
 
virtual bool Import (const std::string &path, ImportOptions *options) override
 
virtual void GatherProperties (std::vector< Property > &outProps) override
 
virtual glm::vec4 GetTypeColor () override
 
virtual const char * GetTypeName () override
 
virtual bool ShouldSnapshotForPie () const override
 
SpriteFrameSourceMode GetMode () const
 
void SetMode (SpriteFrameSourceMode mode)
 
const std::string & GetAnimationName () const
 
void SetAnimationName (const std::string &name)
 
float GetFps () const
 
void SetFps (float fps)
 
bool GetLoop () const
 
void SetLoop (bool loop)
 
const std::vector< TextureRef > & GetFrames () const
 
std::vector< TextureRef > & GetFramesMutable ()
 
void AddFrame (Texture *tex)
 
void ClearFrames ()
 
TextureGetAtlasTexture () const
 
void SetAtlasTexture (Texture *tex)
 
int32_t GetAtlasCols () const
 
int32_t GetAtlasRows () const
 
void SetAtlasGrid (int32_t cols, int32_t rows)
 
void SetAtlasMargin (int32_t x, int32_t y)
 
void SetAtlasSpacing (int32_t x, int32_t y)
 
const std::vector< int32_t > & GetAtlasFrameIndices () const
 
std::vector< int32_t > & GetAtlasFrameIndicesMutable ()
 
int32_t GetFrameCount () const
 
TextureGetFrameTexture (int32_t frameIndex) const
 
bool GetFrameUV (int32_t frameIndex, glm::vec2 &outUV0, glm::vec2 &outUV1) const
 
- Public Member Functions inherited from Asset
 DECLARE_FACTORY_MANAGER (Asset)
 
 DECLARE_FACTORY (Asset, Asset)
 
 DECLARE_OBJECT (Asset, Object)
 
 Asset ()
 
virtual ~Asset ()
 
virtual void Copy (Asset *srcAsset)
 
const std::string & GetName () const
 
bool IsLoaded () const
 
bool IsRefCounted () const
 
int32_t GetRefCount () const
 
bool IsEmbedded () const
 
void SetEmbedded (bool embed)
 
bool IsEngineAsset () const
 
void SetEngineAsset (bool engineAsset)
 
void SetName (const std::string &name)
 
void IncrementRefCount ()
 
void DecrementRefCount ()
 
void LoadFile (const char *path, AsyncLoadRequest *request=nullptr)
 
void LoadEmbedded (const EmbeddedFile *embeddedAsset, AsyncLoadRequest *request=nullptr)
 
void SaveFile (const char *path, Platform platform)
 
virtual const char * GetTypeImportExt ()
 
bool IsTransient () const
 
void SetTransient (bool transient)
 
uint64_t GetUuid () const
 
void SetUuid (uint64_t uuid)
 
void EnsureUuid ()
 
void WriteHeader (Stream &stream)
 
- Public Member Functions inherited from Object
virtual ~Object ()=default
 
virtual const char * RuntimeName () const =0
 
virtual const char * RuntimeParentName () const =0
 
virtual RuntimeId InstanceRuntimeId () const =0
 
virtual ObjectQueryInterface (RuntimeId id) const
 
virtual bool Is (RuntimeId id) const
 
virtual bool Is (const char *name) const
 
virtual bool DrawCustomProperty (Property &prop)
 
template<typename T >
T * As () const
 
virtual bool Equals (const Object *rhs) const
 

Static Protected Member Functions

static bool HandlePropChange (Datum *datum, uint32_t index, const void *newValue)
 

Protected Attributes

std::string mAnimationName
 
SpriteFrameSourceMode mMode = SpriteFrameSourceMode::Discrete
 
float mFps = 12.0f
 
bool mLoop = true
 
std::vector< TextureRefmFrames
 
AssetRef mAtlasTexture
 
int32_t mAtlasCols = 1
 
int32_t mAtlasRows = 1
 
int32_t mAtlasMarginX = 0
 
int32_t mAtlasMarginY = 0
 
int32_t mAtlasSpacingX = 0
 
int32_t mAtlasSpacingY = 0
 
std::vector< int32_t > mAtlasFrameIndices
 
bool mEditAtlasButton = false
 
- Protected Attributes inherited from Asset
uint32_t mVersion = 0
 
TypeId mType = INVALID_TYPE_ID
 
uint64_t mUuid = 0
 
bool mEmbedded = false
 
bool mLoaded = false
 
bool mEnableRefCount = true
 
bool mEngineAsset = false
 
bool mTransient = false
 
std::string mName = "Asset"
 
int32_t mRefCount = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Asset
static AssetHeader ReadHeader (Stream &stream)
 
static std::string GetNameFromPath (const std::string &path)
 
static std::string GetDirectoryFromPath (const std::string &path)
 
static const char * GetNameFromTypeId (TypeId id)
 
static TypeId GetTypeIdFromName (const char *name)
 
- Static Public Member Functions inherited from Object
static const char * ClassRuntimeName ()
 

Constructor & Destructor Documentation

◆ SpriteAnimation()

SpriteAnimation::SpriteAnimation ( )

◆ ~SpriteAnimation()

SpriteAnimation::~SpriteAnimation ( )
virtual

Member Function Documentation

◆ AddFrame()

void SpriteAnimation::AddFrame ( Texture tex)

◆ ClearFrames()

void SpriteAnimation::ClearFrames ( )

◆ Create()

void SpriteAnimation::Create ( )
overridevirtual

Reimplemented from Asset.

◆ DECLARE_ASSET()

SpriteAnimation::DECLARE_ASSET ( SpriteAnimation  ,
Asset   
)

◆ Destroy()

void SpriteAnimation::Destroy ( )
overridevirtual

Reimplemented from Asset.

◆ GatherProperties()

void SpriteAnimation::GatherProperties ( std::vector< Property > &  outProps)
overridevirtual

Reimplemented from Asset.

◆ GetAnimationName()

const std::string & SpriteAnimation::GetAnimationName ( ) const
inline

◆ GetAtlasCols()

int32_t SpriteAnimation::GetAtlasCols ( ) const
inline

◆ GetAtlasFrameIndices()

const std::vector< int32_t > & SpriteAnimation::GetAtlasFrameIndices ( ) const
inline

◆ GetAtlasFrameIndicesMutable()

std::vector< int32_t > & SpriteAnimation::GetAtlasFrameIndicesMutable ( )
inline

◆ GetAtlasRows()

int32_t SpriteAnimation::GetAtlasRows ( ) const
inline

◆ GetAtlasTexture()

Texture * SpriteAnimation::GetAtlasTexture ( ) const

◆ GetFps()

float SpriteAnimation::GetFps ( ) const
inline

◆ GetFrameCount()

int32_t SpriteAnimation::GetFrameCount ( ) const

◆ GetFrames()

const std::vector< TextureRef > & SpriteAnimation::GetFrames ( ) const
inline

◆ GetFramesMutable()

std::vector< TextureRef > & SpriteAnimation::GetFramesMutable ( )
inline

◆ GetFrameTexture()

Texture * SpriteAnimation::GetFrameTexture ( int32_t  frameIndex) const

◆ GetFrameUV()

bool SpriteAnimation::GetFrameUV ( int32_t  frameIndex,
glm::vec2 &  outUV0,
glm::vec2 &  outUV1 
) const

◆ GetLoop()

bool SpriteAnimation::GetLoop ( ) const
inline

◆ GetMode()

SpriteFrameSourceMode SpriteAnimation::GetMode ( ) const
inline

◆ GetTypeColor()

glm::vec4 SpriteAnimation::GetTypeColor ( )
overridevirtual

Reimplemented from Asset.

◆ GetTypeName()

const char * SpriteAnimation::GetTypeName ( )
overridevirtual

Reimplemented from Asset.

◆ HandlePropChange()

bool SpriteAnimation::HandlePropChange ( Datum datum,
uint32_t  index,
const void *  newValue 
)
staticprotected

◆ Import()

bool SpriteAnimation::Import ( const std::string &  path,
ImportOptions options 
)
overridevirtual

Reimplemented from Asset.

◆ LoadStream()

void SpriteAnimation::LoadStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Asset.

◆ SaveStream()

void SpriteAnimation::SaveStream ( Stream stream,
Platform  platform 
)
overridevirtual

Reimplemented from Asset.

◆ SetAnimationName()

void SpriteAnimation::SetAnimationName ( const std::string &  name)
inline

◆ SetAtlasGrid()

void SpriteAnimation::SetAtlasGrid ( int32_t  cols,
int32_t  rows 
)
inline

◆ SetAtlasMargin()

void SpriteAnimation::SetAtlasMargin ( int32_t  x,
int32_t  y 
)
inline

◆ SetAtlasSpacing()

void SpriteAnimation::SetAtlasSpacing ( int32_t  x,
int32_t  y 
)
inline

◆ SetAtlasTexture()

void SpriteAnimation::SetAtlasTexture ( Texture tex)

◆ SetFps()

void SpriteAnimation::SetFps ( float  fps)
inline

◆ SetLoop()

void SpriteAnimation::SetLoop ( bool  loop)
inline

◆ SetMode()

void SpriteAnimation::SetMode ( SpriteFrameSourceMode  mode)
inline

◆ ShouldSnapshotForPie()

virtual bool SpriteAnimation::ShouldSnapshotForPie ( ) const
inlineoverridevirtual

Reimplemented from Asset.

Member Data Documentation

◆ mAnimationName

std::string SpriteAnimation::mAnimationName
protected

◆ mAtlasCols

int32_t SpriteAnimation::mAtlasCols = 1
protected

◆ mAtlasFrameIndices

std::vector<int32_t> SpriteAnimation::mAtlasFrameIndices
protected

◆ mAtlasMarginX

int32_t SpriteAnimation::mAtlasMarginX = 0
protected

◆ mAtlasMarginY

int32_t SpriteAnimation::mAtlasMarginY = 0
protected

◆ mAtlasRows

int32_t SpriteAnimation::mAtlasRows = 1
protected

◆ mAtlasSpacingX

int32_t SpriteAnimation::mAtlasSpacingX = 0
protected

◆ mAtlasSpacingY

int32_t SpriteAnimation::mAtlasSpacingY = 0
protected

◆ mAtlasTexture

AssetRef SpriteAnimation::mAtlasTexture
protected

◆ mEditAtlasButton

bool SpriteAnimation::mEditAtlasButton = false
protected

◆ mFps

float SpriteAnimation::mFps = 12.0f
protected

◆ mFrames

std::vector<TextureRef> SpriteAnimation::mFrames
protected

◆ mLoop

bool SpriteAnimation::mLoop = true
protected

◆ mMode

SpriteFrameSourceMode SpriteAnimation::mMode = SpriteFrameSourceMode::Discrete
protected

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