Athena IO Library
SpriteFrame.hpp
1 #ifndef ATHENA_NO_SAKURA
2 // This file is part of libAthena.
3 //
4 // libAthena is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // libAthena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with libAthena. If not, see <http://www.gnu.org/licenses/>
16 
17 #ifndef SSPRITEFRAME_HPP
18 #define SSPRITEFRAME_HPP
19 
20 
21 #include "Athena/Global.hpp"
22 
23 #ifndef ATHENA_USE_QT
24 #include <vector>
25 #else
26 #include <QObject>
27 #include <QList>
28 #endif
29 
30 namespace Athena
31 {
32 namespace Sakura
33 {
34 
35 class Sprite;
36 class SpritePart;
37 
38 #ifndef ATHENA_USE_QT
40 {
41 #else
42 class SpriteFrame : public QObject
43 {
44  Q_OBJECT
45  Q_PROPERTY(qreal frameTime READ frameTime WRITE setFrameTime)
46 #endif
47 public:
51  SpriteFrame();
52 
53  SpriteFrame(Sprite* root);
58  void setFrameTime(float frameTime);
59 
60 
65  float frameTime() const;
66 
67 #ifndef ATHENA_USE_QT
68  void setParts(std::vector<SpritePart*> parts);
69  std::vector<SpritePart*> parts() const;
70 #else
71  void setParts(QList<SpritePart*> parts);
72  QList<SpritePart*> parts() const;
73 #endif
74 
75  atUint32 partCount() const;
76 
77  void setRoot(Sprite* root);
78  Sprite* root() const;
79 #ifdef ATHENA_USE_QT
80 signals:
81  void frameTimeChanged(float);
82 #endif
83 private:
84  Sprite* m_root;
85  float m_frameTime;
86 #ifndef ATHENA_USE_QT
87  std::vector<SpritePart*> m_parts;
88 #else
89  QList<SpritePart*> m_parts;
90 #endif
91 };
92 
93 } // Sakura
94 } // zelda
95 
96 #ifdef ATHENA_USE_QT
97 Q_DECLARE_METATYPE(Athena::Sakura::SpriteFrame*);
98 #endif
99 
100 #endif // SSPRITEFRAME_HPP
101 #endif // ATHENA_NO_SAKURA
void setFrameTime(float frameTime)
setFrameTime
SpriteFrame()
SSpriteFrame.
float frameTime() const
frameTime