2014-01-26 04:56:04 +00:00
|
|
|
#include "SpriteFrame.hpp"
|
|
|
|
#include "SpritePart.hpp"
|
2014-02-27 05:47:39 +00:00
|
|
|
#include "Sprite.hpp"
|
2014-01-26 04:56:04 +00:00
|
|
|
|
|
|
|
namespace zelda
|
|
|
|
{
|
|
|
|
namespace Sakura
|
|
|
|
{
|
|
|
|
|
|
|
|
SpriteFrame::SpriteFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
SpriteFrame::SpriteFrame(Sprite* root)
|
|
|
|
: m_root(root)
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
void SpriteFrame::setFrameTime(float frameTime)
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
m_frameTime = frameTime;
|
|
|
|
#ifdef LIBZELDA_USE_QT
|
|
|
|
emit frameTimeChanged(frameTime);
|
|
|
|
#endif
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
#ifndef LIBZELDA_USE_QT
|
|
|
|
void SpriteFrame::setParts(std::vector<SpritePart*> parts)
|
|
|
|
#else
|
|
|
|
void SpriteFrame::setParts(QList<SpritePart*> parts)
|
|
|
|
#endif
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
m_parts = parts;
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
#ifndef LIBZELDA_USE_QT
|
|
|
|
std::vector<SpritePart*> SpriteFrame::parts() const
|
|
|
|
#else
|
|
|
|
QList<SpritePart*> SpriteFrame::parts() const
|
|
|
|
#endif
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
return m_parts;
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
Uint32 SpriteFrame::partCount() const
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
return m_parts.size();
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
float SpriteFrame::frameTime() const
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
return m_frameTime;
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
void SpriteFrame::setRoot(Sprite* root)
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
root->removeFrame(this);
|
|
|
|
m_root = root;
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 05:47:39 +00:00
|
|
|
Sprite* SpriteFrame::root() const
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
2014-02-27 05:47:39 +00:00
|
|
|
return m_root;
|
2014-01-26 04:56:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // Sakura
|
|
|
|
} // zelda
|