diff options
Diffstat (limited to 'pacman-c++/sceneholder.h')
| -rw-r--r-- | pacman-c++/sceneholder.h | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/pacman-c++/sceneholder.h b/pacman-c++/sceneholder.h deleted file mode 100644 index 7d6e556..0000000 --- a/pacman-c++/sceneholder.h +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | #ifndef SCENEHOLDER_H | ||
| 2 | #define SCENEHOLDER_H | ||
| 3 | |||
| 4 | #include "constants.h" | ||
| 5 | #include <QtGui> | ||
| 6 | |||
| 7 | class GameEntity; | ||
| 8 | class Actor; | ||
| 9 | |||
| 10 | class SceneHolder | ||
| 11 | : public QGraphicsScene | ||
| 12 | { | ||
| 13 | Q_OBJECT | ||
| 14 | |||
| 15 | public: | ||
| 16 | SceneHolder(QObject *parent = 0); | ||
| 17 | virtual ~SceneHolder() | ||
| 18 | {}; | ||
| 19 | void reset(); | ||
| 20 | unsigned int pointsLeft(); | ||
| 21 | void updateMap(const Transmission::map_t& map); | ||
| 22 | void updateMap(const Transmission::map_t& map, const unsigned int x, const unsigned int y); | ||
| 23 | void setColor(Color::Color color = Color::none); | ||
| 24 | Color::Color color(); | ||
| 25 | void setEatingOrder(QList<Color::Color> &order); | ||
| 26 | QList<Color::Color> &eatingOrder(); | ||
| 27 | void showEatingText(bool show = true); | ||
| 28 | |||
| 29 | signals: | ||
| 30 | void allPointsRemoved(); | ||
| 31 | |||
| 32 | private slots: | ||
| 33 | void decrementPoints(); | ||
| 34 | |||
| 35 | protected: | ||
| 36 | /* process items that got delayed by one tick */ | ||
| 37 | void processDelayedItems(); | ||
| 38 | /* data conversion */ | ||
| 39 | QPoint mapPositionToCoord(unsigned int x, unsigned int y); | ||
| 40 | QPoint mapPositionToCoord(QPoint point); | ||
| 41 | QPoint CoordToMapPosition(unsigned int x, unsigned int y); | ||
| 42 | QPoint CoordToMapPosition(QPoint point); | ||
| 43 | |||
| 44 | protected: | ||
| 45 | /* map of all pixmap instances */ | ||
| 46 | QVector< QVector<GameEntity *> > visualMap; | ||
| 47 | |||
| 48 | /* map of actors in order to keep track of those instances */ | ||
| 49 | QMap<Color::Color, Actor *> m_actors; | ||
| 50 | |||
| 51 | /* items that got removed/has been eaten | ||
| 52 | * must be remove one tick later | ||
| 53 | */ | ||
| 54 | QList<GameEntity *> m_oldItems; | ||
| 55 | /* we need to store items that killed an actor too (e.g. colored blocks) */ | ||
| 56 | QMap<Color::Color, GameEntity *> m_death; | ||
| 57 | |||
| 58 | /* my local color */ | ||
| 59 | Color::Color m_color; | ||
| 60 | |||
| 61 | /* a actor can only eat his upper neighbour | ||
| 62 | * the order of the neighbours is determined by the colors order (sent from server) | ||
| 63 | * please note that !pl1.canEat(pl2, ...) doesn't necessarily mean that pl2 can eat pl1 | ||
| 64 | * order MUST be in this format: [col1, [col2 ... colN], col1] | ||
| 65 | */ | ||
| 66 | QList<Color::Color> m_eatingorder; | ||
| 67 | |||
| 68 | /* points left before round ends */ | ||
| 69 | unsigned int m_pointsLeft; | ||
| 70 | QGraphicsTextItem *m_overlayText; | ||
| 71 | }; | ||
| 72 | |||
| 73 | #endif // SCENEHOLDER_H | ||
