diff options
Diffstat (limited to 'pacman-c++/common/block.h')
| -rw-r--r-- | pacman-c++/common/block.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pacman-c++/common/block.h b/pacman-c++/common/block.h new file mode 100644 index 0000000..abfbc5a --- /dev/null +++ b/pacman-c++/common/block.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #ifndef BLOCK_H | ||
| 2 | #define BLOCK_H | ||
| 3 | |||
| 4 | #include "gameentity.h" | ||
| 5 | #include "constants.h" | ||
| 6 | #include <QMap> | ||
| 7 | |||
| 8 | class Block | ||
| 9 | : public GameEntity | ||
| 10 | { | ||
| 11 | public: | ||
| 12 | enum Neighbour | ||
| 13 | { | ||
| 14 | None = 0, | ||
| 15 | Left = (1 << 0), | ||
| 16 | Right = (1 << 1), | ||
| 17 | Up = (1 << 2), | ||
| 18 | Down = (1 << 3) | ||
| 19 | }; | ||
| 20 | |||
| 21 | enum | ||
| 22 | { | ||
| 23 | Type = UserType + Transmission::block | ||
| 24 | }; | ||
| 25 | |||
| 26 | public: | ||
| 27 | Block(Color::Color color, unsigned int neighbours = None, QGraphicsItem *parent = 0); | ||
| 28 | virtual ~Block() | ||
| 29 | {}; | ||
| 30 | |||
| 31 | unsigned int neighbours(); | ||
| 32 | void setNeighbours(unsigned int neighbours); | ||
| 33 | virtual bool checkEnter(Actor *actor); | ||
| 34 | virtual EnteredState enter(Actor *actor); | ||
| 35 | virtual void onDie(Actor *); | ||
| 36 | |||
| 37 | private: | ||
| 38 | // map for saving QPixmaps for reuse | ||
| 39 | static QMap<Color::Color, QPixmap> m_pixmaps; | ||
| 40 | unsigned int m_neighbours; | ||
| 41 | }; | ||
| 42 | |||
| 43 | #endif // BLOCK_H | ||
