athena/include/Athena/SpriteFrame.hpp

100 lines
2.1 KiB
C++
Raw Normal View History

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/>
#ifndef SSPRITEFRAME_HPP
#define SSPRITEFRAME_HPP
2014-04-20 09:14:15 +00:00
#include "Athena/Global.hpp"
2014-02-27 05:47:39 +00:00
#ifndef LIBZELDA_USE_QT
#include <vector>
2014-02-27 05:47:39 +00:00
#else
#include <QObject>
#include <QList>
#endif
2014-04-20 09:14:15 +00:00
namespace Athena
{
namespace Sakura
{
2014-02-27 05:47:39 +00:00
class Sprite;
class SpritePart;
#ifndef LIBZELDA_USE_QT
class SpriteFrame
{
2014-02-27 05:47:39 +00:00
#else
class SpriteFrame : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal frameTime READ frameTime WRITE setFrameTime)
#endif
public:
/*!
* \brief SSpriteFrame
*/
SpriteFrame();
2014-02-27 05:47:39 +00:00
SpriteFrame(Sprite* root);
/*!
* \brief setFrameTime
* \param frameTime
*/
void setFrameTime(float frameTime);
2014-02-27 05:47:39 +00:00
/*!
* \brief frameTime
* \return
*/
float frameTime() const;
2014-02-27 05:47:39 +00:00
#ifndef LIBZELDA_USE_QT
void setParts(std::vector<SpritePart*> parts);
std::vector<SpritePart*> parts() const;
#else
void setParts(QList<SpritePart*> parts);
QList<SpritePart*> parts() const;
#endif
Uint32 partCount() const;
void setRoot(Sprite* root);
Sprite* root() const;
#ifdef LIBZELDA_USE_QT
signals:
void frameTimeChanged(float);
#endif
private:
2014-02-27 05:47:39 +00:00
Sprite* m_root;
float m_frameTime;
#ifndef LIBZELDA_USE_QT
std::vector<SpritePart*> m_parts;
#else
QList<SpritePart*> m_parts;
#endif
};
} // Sakura
} // zelda
2014-02-27 05:47:39 +00:00
#ifdef LIBZELDA_USE_QT
Q_DECLARE_METATYPE(zelda::Sakura::SpriteFrame*);
#endif
#endif // SSPRITEFRAME_HPP