diff options
Diffstat (limited to 'pacman-c++/gameentity.h')
| -rw-r--r-- | pacman-c++/gameentity.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pacman-c++/gameentity.h b/pacman-c++/gameentity.h index 2fde095..92b485e 100644 --- a/pacman-c++/gameentity.h +++ b/pacman-c++/gameentity.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include "constants.h" | 4 | #include "constants.h" |
| 5 | #include "pixmapitem.h" | 5 | #include "pixmapitem.h" |
| 6 | #include <QtGlobal> | 6 | #include <QtGlobal> |
| 7 | #include <QDebug> | ||
| 7 | 8 | ||
| 8 | class Actor; | 9 | class Actor; |
| 9 | 10 | ||
| @@ -14,6 +15,12 @@ class GameEntity | |||
| 14 | : public PixmapItem | 15 | : public PixmapItem |
| 15 | { | 16 | { |
| 16 | public: | 17 | public: |
| 18 | enum | ||
| 19 | { | ||
| 20 | Type = UserType + 1 | ||
| 21 | }; | ||
| 22 | |||
| 23 | public: | ||
| 17 | GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0); | 24 | GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0); |
| 18 | GameEntity(QGraphicsItem *parent); | 25 | GameEntity(QGraphicsItem *parent); |
| 19 | virtual ~GameEntity() | 26 | virtual ~GameEntity() |
| @@ -52,7 +59,14 @@ public: | |||
| 52 | virtual void onDie(Actor *) | 59 | virtual void onDie(Actor *) |
| 53 | {}; | 60 | {}; |
| 54 | 61 | ||
| 62 | /* enable the use of qgraphicsitem_cast with this item */ | ||
| 63 | int type() const | ||
| 64 | { | ||
| 65 | return m_type; | ||
| 66 | } | ||
| 67 | |||
| 55 | protected: | 68 | protected: |
| 69 | int m_type; | ||
| 56 | bool m_eaten; | 70 | bool m_eaten; |
| 57 | Color::Color m_color; | 71 | Color::Color m_color; |
| 58 | }; | 72 | }; |
