2014-04-20 09:14:15 +00:00
|
|
|
// This file is part of libAthena.
|
|
|
|
//
|
|
|
|
// libAthena is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// libAthena is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with libAthena. If not, see <http://www.gnu.org/licenses/>
|
2014-01-26 04:56:04 +00:00
|
|
|
|
2014-04-20 09:14:15 +00:00
|
|
|
#include "Athena/SpriteFrame.hpp"
|
|
|
|
#include "Athena/SpritePart.hpp"
|
|
|
|
#include "Athena/Sprite.hpp"
|
|
|
|
|
|
|
|
namespace Athena
|
2014-01-26 04:56:04 +00:00
|
|
|
{
|
|
|
|
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
|