13 #include "athena/SakuraGlobal.hpp" 26 class Sprite :
public QObject
29 Q_PROPERTY(QString name READ name WRITE setName)
30 Q_PROPERTY(qreal currentState READ currentState WRITE setCurrentState)
31 Q_PROPERTY(qreal stateCount READ stateCount CONSTANT)
39 virtual void setPosition(
const float x,
const float y);
41 virtual void setPosition(
const Vector2Df& pos);
43 void setName(
const std::string& name);
44 std::string name()
const;
46 virtual void setPosition(
const QPoint& pos);
47 virtual QPoint position()
const;
48 void setName(
const QString& name);
52 void addStateId(
int id);
60 void setStateIds(std::vector<int> ids);
62 std::vector<int> stateIds()
const;
64 QList<int> stateIds()
const;
66 atUint32 stateCount()
const;
67 void setCurrentState(atUint32
id);
68 atUint32 currentState()
const;
73 void setFrame(atUint32
id);
75 void setFrames(std::vector<SpriteFrame*> frames);
77 void setFrames(QList<SpriteFrame*> frames);
79 atUint32 frameCount()
const;
82 std::vector<SpriteFrame*> frames()
const;
84 QList<SpriteFrame*> frames()
const;
90 void setCurrentFrame(atUint32
id);
101 void nameChanged(QString);
102 void stateChanged(quint32);
106 #ifndef ATHENA_USE_QT 109 std::vector<int> m_stateIds;
110 std::vector<SpriteFrame*> m_frames;
114 QList<int> m_stateIds;
115 QList<SpriteFrame*> m_frames;
117 atUint32 m_currentState;
118 atUint32 m_currentFrame;
126 Q_DECLARE_METATYPE(Uint32)
130 #endif // SSPRITE_HPP
int stateId(int index) const
Returns the texture id of a given state.