diff options
Diffstat (limited to 'pacman-c++/actor.h')
| -rw-r--r-- | pacman-c++/actor.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/pacman-c++/actor.h b/pacman-c++/actor.h index 39ccb88..68bf06f 100644 --- a/pacman-c++/actor.h +++ b/pacman-c++/actor.h | |||
| @@ -3,30 +3,42 @@ | |||
| 3 | 3 | ||
| 4 | #include "pixmapitem.h" | 4 | #include "pixmapitem.h" |
| 5 | #include "constants.h" | 5 | #include "constants.h" |
| 6 | #include <QtCore/QSequentialAnimationGroup> | ||
| 7 | #include <QtCore/QParallelAnimationGroup> | ||
| 8 | #include <QList> | ||
| 6 | 9 | ||
| 7 | class Actor | 10 | class Actor |
| 8 | : public PixmapItem | 11 | : public PixmapItem |
| 9 | { | 12 | { |
| 10 | public: | 13 | public: |
| 11 | enum Movement { | 14 | enum Movement { |
| 12 | None = 0, | 15 | None = 0, |
| 13 | Left, | 16 | Left, |
| 14 | Right, | 17 | Right, |
| 15 | Up, | 18 | Up, |
| 16 | Down | 19 | Down, |
| 17 | }; | 20 | }; |
| 18 | 21 | ||
| 19 | Actor(Color::Color color, QGraphicsItem *parent = 0); | 22 | Actor(Color::Color color, bool local = false, QGraphicsItem *parent = 0); |
| 20 | virtual ~Actor() {}; | 23 | virtual ~Actor() {}; |
| 21 | 24 | ||
| 25 | QSequentialAnimationGroup *setupEatingAnimation(Actor::Movement direction); | ||
| 26 | Color::Color getColor(); | ||
| 22 | PixmapItem &getIcon(); | 27 | PixmapItem &getIcon(); |
| 23 | Color::Color getColor() { return m_color; } | 28 | bool isLocal(); |
| 29 | void move(Movement direction); | ||
| 30 | bool isMoving(); | ||
| 24 | 31 | ||
| 25 | private: | 32 | private: |
| 26 | QPixmap m_pix; | 33 | QPixmap m_pix; |
| 27 | Color::Color m_color; | 34 | Color::Color m_color; |
| 28 | Movement m_direction; | 35 | Movement m_direction; |
| 29 | PixmapItem m_icon; | 36 | PixmapItem m_icon; |
| 37 | bool m_local; | ||
| 38 | |||
| 39 | QList<PixmapItem *> m_images; | ||
| 40 | QList<QSequentialAnimationGroup *> m_eating; | ||
| 41 | QParallelAnimationGroup *m_moving; | ||
| 30 | }; | 42 | }; |
| 31 | 43 | ||
| 32 | #endif // ACTOR_H | 44 | #endif // ACTOR_H |
