diff options
| -rw-r--r-- | pacman-c++/actor.cpp | 9 | ||||
| -rw-r--r-- | pacman-c++/actor.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index d900e57..4f28088 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -20,6 +20,10 @@ Actor::Actor(Color color, QGraphicsItem *parent) | |||
| 20 | // higher player "over" lower player | 20 | // higher player "over" lower player |
| 21 | setZValue(m_color * 10); | 21 | setZValue(m_color * 10); |
| 22 | 22 | ||
| 23 | /* setup icon for player */ | ||
| 24 | m_icon.setPixmap(m_pix); | ||
| 25 | m_icon.setSprite(SPRITE_MARGIN, SPRITE_MARGIN, SPRITE_WIDTH, SPRITE_HEIGHT); | ||
| 26 | |||
| 23 | m_direction = Actor::Left; | 27 | m_direction = Actor::Left; |
| 24 | 28 | ||
| 25 | qRegisterAnimationInterpolator<bool>(myBooleanInterpolator); | 29 | qRegisterAnimationInterpolator<bool>(myBooleanInterpolator); |
| @@ -57,3 +61,8 @@ Actor::Actor(Color color, QGraphicsItem *parent) | |||
| 57 | eating->start(); | 61 | eating->start(); |
| 58 | moving->start(); | 62 | moving->start(); |
| 59 | } | 63 | } |
| 64 | |||
| 65 | PixmapItem &Actor::getIcon() | ||
| 66 | { | ||
| 67 | return m_icon; | ||
| 68 | } | ||
diff --git a/pacman-c++/actor.h b/pacman-c++/actor.h index 5bec353..5e9ed72 100644 --- a/pacman-c++/actor.h +++ b/pacman-c++/actor.h | |||
| @@ -17,11 +17,13 @@ public: | |||
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | Actor(Color color, QGraphicsItem *parent = 0); | 19 | Actor(Color color, QGraphicsItem *parent = 0); |
| 20 | PixmapItem &getIcon(); | ||
| 20 | 21 | ||
| 21 | private: | 22 | private: |
| 22 | QPixmap m_pix; | 23 | QPixmap m_pix; |
| 23 | Color m_color; | 24 | Color m_color; |
| 24 | Movement m_direction; | 25 | Movement m_direction; |
| 26 | PixmapItem m_icon; | ||
| 25 | }; | 27 | }; |
| 26 | 28 | ||
| 27 | #endif // ACTOR_H | 29 | #endif // ACTOR_H |
